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:
Dmitry Shulyak 2015-10-15 17:50:31 +03:00
parent d53ecc71e4
commit 5807a09609
5 changed files with 57 additions and 0 deletions

View 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

View 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:

View File

@ -0,0 +1,3 @@
Package: {{package}}
Pin: {{pin}}
Pin-Priority: {{pin_priority}}

View 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

View 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