mirror of
https://github.com/luzifer-ansible/apt.git
synced 2024-12-22 08:41:17 +00:00
Initial version
This commit is contained in:
commit
a5fa2bf52d
2 changed files with 49 additions and 0 deletions
8
defaults/main.yml
Normal file
8
defaults/main.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
|
||||
apt_keys: []
|
||||
apt_packages: []
|
||||
apt_refresh_interval: 86400
|
||||
apt_repos: []
|
||||
|
||||
...
|
41
tasks/main.yml
Normal file
41
tasks/main.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
|
||||
- name: Install APT keys
|
||||
apt_key:
|
||||
data: '{{ item.data | default(omit) }}'
|
||||
file: '{{ item.file | default(omit) }}'
|
||||
id: '{{ item.id | default(omit) }}'
|
||||
keyserver: '{{ item.keyserver | default(omit) }}'
|
||||
state: '{{ item.state | default("present") }}'
|
||||
url: '{{ item.url | default(omit) }}'
|
||||
with_items: '{{ apt_keys }}'
|
||||
register: apt_keys_task
|
||||
|
||||
- name: Add APT repositories
|
||||
apt_repository:
|
||||
codename: '{{ item.codename | default(omit) }}'
|
||||
repo: '{{ item.repo }}'
|
||||
state: '{{ item.state | default("present") }}'
|
||||
update_cache: "no"
|
||||
with_items: '{{ apt_repos }}'
|
||||
register: apt_repos_task
|
||||
|
||||
- name: Update cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
when: apt_keys_task.changed or apt_repos_task.changed
|
||||
|
||||
- name: Install APT packages
|
||||
apt:
|
||||
cache_valid_time: '{{ apt_refresh_interval }}'
|
||||
deb: '{{ item.deb | default(omit) }}'
|
||||
default_release: '{{ item.default_release | default(omit) }}'
|
||||
force: '{{ item.force | default("no") }}'
|
||||
install_recommends: '{{ item.install_recommends | default(omit) }}'
|
||||
name: '{{ item.name }}'
|
||||
purge: '{{ item.purge | default("no") }}'
|
||||
state: '{{ item.state | default("present") }}'
|
||||
upgrade: '{{ item.upgrade | default(omit) }}'
|
||||
with_items: '{{ apt_packages }}'
|
||||
|
||||
...
|
Loading…
Reference in a new issue