-
Notifications
You must be signed in to change notification settings - Fork 1
/
arch-repos.yml
59 lines (51 loc) · 1.48 KB
/
arch-repos.yml
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
- name: Arch packaging
hosts: arch
become: true
vars:
mirrorlist: /etc/pacman.d/mirrorlist
repos: [core, extra, community, multilib]
deprecated: [atlassian, testing]
tasks:
- name: Ensure old repos are deleted
file:
name: '/etc/pacman.d/repo.{{item}}'
state: absent
with_items: '{{deprecated}}'
- name: Disable all repos (no includes)
lineinfile: dest=/etc/pacman.conf
state=absent
regexp='^Include\s*=\s*/etc/pacman\.d/repo'
notify: Update packages
- name: Disable all repos (no sections)
replace: dest=/etc/pacman.conf
regexp='^\[(?!options\]$)(.+)\]$'
replace='#[\1]'
notify: Update packages
- name: Add include for chosen repos
lineinfile: dest=/etc/pacman.conf
line='Include = /etc/pacman.d/ansible.repos'
notify: Update packages
- name: Create file for each repo
copy:
content: |
[{{item}}]
Include = {{mirrorlist}}
dest: /etc/pacman.d/repo.{{item}}
owner: root
group: root
mode: 0644
with_items: '{{repos}}'
notify: Update packages
- name: Master repo list
template:
src: templates/ansible.repos.j2
dest: /etc/pacman.d/ansible.repos
owner: root
group: root
mode: 0644
notify: Update packages
handlers:
- name: Refresh keys
command: pacman-key --refresh-keys
- name: Update packages
command: pacman -Syy