Add apt_repo resource and managed_apt resources
apt_repo used to describe single repository, supports pinning managed_apt used to cleanup other repos, and ensure that we are using only one
This commit is contained in:
parent
d53ecc71e4
commit
5807a09609
9
resources/apt_repo/actions/run.yaml
Normal file
9
resources/apt_repo/actions/run.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
- hosts: [{{host}}]
|
||||
sudo: yes
|
||||
tasks:
|
||||
- apt_repository: repo={{repo}} validate_certs=no
|
||||
- file: path=/etc/apt/preferences.d/{{name}}.pref state=touch
|
||||
- template:
|
||||
src: {{templates_dir}}/preferences
|
||||
dest: /etc/apt/preferences.d/{{name}}.pref
|
||||
- shell: apt-get update
|
22
resources/apt_repo/meta.yaml
Normal file
22
resources/apt_repo/meta.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
id: apt_repo
|
||||
handler: ansible
|
||||
version: 1.0.0
|
||||
input:
|
||||
ip:
|
||||
schema: str!
|
||||
value:
|
||||
repo:
|
||||
schema: str!
|
||||
value:
|
||||
name:
|
||||
schema: str!
|
||||
value:
|
||||
package:
|
||||
schema: str
|
||||
value: '*'
|
||||
pin:
|
||||
schema: str
|
||||
value:
|
||||
pin_priority:
|
||||
schema: str
|
||||
value:
|
3
resources/apt_repo/templates/preferences
Normal file
3
resources/apt_repo/templates/preferences
Normal file
@ -0,0 +1,3 @@
|
||||
Package: {{package}}
|
||||
Pin: {{pin}}
|
||||
Pin-Priority: {{pin_priority}}
|
6
resources/managed_apt/actions/run.yaml
Normal file
6
resources/managed_apt/actions/run.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
- hosts: [{{host}}]
|
||||
sudo: yes
|
||||
tasks:
|
||||
- shell: echo 'Managed by solar' > /etc/apt/sources.list
|
||||
when: {{ensure_other_removed}}
|
||||
- shell: apt-get update
|
17
resources/managed_apt/meta.yaml
Normal file
17
resources/managed_apt/meta.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
# This resource will clean
|
||||
id: apt_repo_manager
|
||||
handler: ansible
|
||||
version: 1.0.0
|
||||
input:
|
||||
ip:
|
||||
schema: str!
|
||||
value:
|
||||
repos:
|
||||
schema: [str!]
|
||||
value:
|
||||
names:
|
||||
schema: [str!]
|
||||
value:
|
||||
ensure_other_removed:
|
||||
schema: bool
|
||||
value: true
|
Loading…
Reference in New Issue
Block a user