blob: 3384fb64e6b3a91f472a89d820a188f885516bdd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
---
- name: Don't install recommended packages
copy:
dest: '/etc/apt/apt.conf.d/06norecommends'
src: 06norecommends
owner: root
group: root
mode: 0644
- name: Don't start services by default
copy:
dest: '/usr/sbin/policy-rc.d'
content: "exit 101\n"
owner: root
group: root
mode: 0755
- name: Remove packages
vars:
apt_packages: '{{ apt_packages_default|combine(apt_packages_role) }}'
apt:
name: "{{ apt_packages|dictsort(true)|selectattr(1,'equalto','absent')|map(attribute=0)|list }}"
state: absent
autoremove: yes
purge: yes
tags:
- packages
- name: Create /etc/apt/preferences.d
vars:
apt_preferences: '{{ apt_preferences_default|combine(apt_preferences_role) }}'
template:
dest: '/etc/apt/preferences.d/{{ item.key }}'
src: apt-preferences.j2
owner: root
group: root
mode: 0644
with_dict: '{{ apt_preferences }}'
when: item.value
- name: Remove /etc/apt/preferences.d
vars:
apt_preferences: '{{ apt_preferences_default|combine(apt_preferences_role) }}'
file:
path: '/etc/apt/preferences.d/{{ item.key }}'
state: absent
with_dict: '{{ apt_preferences }}'
when: not item.value
- name: Configure /etc/apt/sources.list
vars:
apt_repos: '{{ apt_repos_default|combine(apt_repos_role) }}'
apt_sources: '{{ apt_sources_default|combine(apt_sources_role) }}'
template:
dest: '/etc/apt/sources.list'
src: sources.list.j2
owner: root
group: root
mode: 0644
when: 'apt_sources|length > 0'
- name: Download repository keys
vars:
apt_repos: '{{ apt_repos_default|combine(apt_repos_role) }}'
apt_sources: '{{ apt_sources_default|combine(apt_sources_role) }}'
apt_key:
url: "{{ apt_repos[item.key]['key_url'] }}"
id: "{{ apt_repos[item.key]['key_id'] }}"
state: present
with_dict: '{{ apt_sources }}'
loop_control:
label: '{{ item.key }}'
when: "'key_url' in apt_repos[item.key]"
- name: Update apt cache
apt:
update_cache: yes
tags:
- update
- packages
- name: Install packages
vars:
apt_packages: '{{ apt_packages_default | combine(apt_packages_role) }}'
apt:
name: "{{ apt_packages|dictsort(true)|selectattr(1,'equalto','present')|map(attribute=0)|list }}"
state: present
tags:
- packages
# vim: set ts=2 sw=2 et:
|