Initialize repo.
This commit is contained in:
commit
003609b705
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
17
LICENSE
Normal file
17
LICENSE
Normal file
@ -0,0 +1,17 @@
|
||||
MIT No Attribution License
|
||||
|
||||
Copyright (c) 2023 Brian Lee
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the “Software”), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
31
README.md
Normal file
31
README.md
Normal file
@ -0,0 +1,31 @@
|
||||
# Ansible Role: aptrepo
|
||||
|
||||
Install packages from alternative apt repositories.
|
||||
|
||||
Tested on:
|
||||
|
||||
* Debian 12
|
||||
|
||||
## Requirements
|
||||
|
||||
None.
|
||||
|
||||
## Example Playbook
|
||||
|
||||
```yaml
|
||||
---
|
||||
- hosts: all
|
||||
become: yes
|
||||
gather_facts: no
|
||||
roles:
|
||||
- role: blee.aptrepo
|
||||
tags: tor
|
||||
vars:
|
||||
aptrepo_key_url: https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc
|
||||
aptrepo_key_filename: deb.torproject.org-keyring.gpg
|
||||
aptrepo_name: torproject
|
||||
aptrepo_url: https://deb.torproject.org/torproject.org
|
||||
aptrepo_packages:
|
||||
- tor
|
||||
- deb.torproject.org-keyring
|
||||
```
|
7
defaults/main.yml
Normal file
7
defaults/main.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
aptrepo_url: ""
|
||||
aptrepo_key_url: ""
|
||||
aptrepo_key_filename: ""
|
||||
aptrepo_packages: []
|
||||
aptrepo_arch: "amd64"
|
||||
aptrepo_components: "stable main"
|
2
meta/main.yml
Normal file
2
meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
dependencies: []
|
26
tasks/main.yml
Normal file
26
tasks/main.yml
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
# https://www.jeffgeerling.com/blog/2022/aptkey-deprecated-debianubuntu-how-fix-ansible
|
||||
- name: Add repository key.
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ aptrepo_key_url }}"
|
||||
dest: "/usr/share/keyrings/{{ aptrepo_key_filename }}"
|
||||
mode: '0644'
|
||||
|
||||
- name: Add repository
|
||||
ansible.builtin.lineinfile:
|
||||
path: "/etc/apt/sources.list.d/{{ aptrepo_name }}.list"
|
||||
regexp: "{{ aptrepo_key_filename }}"
|
||||
line: "deb [arch={{ aptrepo_arch }} signed-by=/usr/share/keyrings/{{ aptrepo_key_filename }}] {{ aptrepo_url }} {{ aptrepo_components }}"
|
||||
create: true
|
||||
register: aptrepo_list
|
||||
|
||||
- name: Update the apt repository cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
when: aptrepo_list.changed
|
||||
|
||||
- name: Install packages
|
||||
ansible.builtin.apt:
|
||||
name: "{{ aptrepo_packages }}"
|
||||
state: latest
|
||||
|
Loading…
Reference in New Issue
Block a user