blob: a571c66178a0b1f89a1b74742efdd73054e3245e (
plain)
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
|
# preliminary: Debian ships with ansible 2.7 (buster) and at least 2.10 (bullseye). Well, in case
# of ansible, Ubuntu is not bleeding edge, so let's get our stuff there. For now, while we don't have
# a more sophisticated package distribution at hand.
---
- hosts: "{{runtime_hosts|default('CHANGE_ME')}}"
gather_facts: "no"
vars:
ans:
11:
release: "impish"
debname: "bullseye"
10:
release: "bionic"
debname: "buster"
9:
release: "xenial"
debname: "stretch"
key:
id: "93C4A3FD7BB9C367"
tasks:
- name: Gather facts subset
setup:
filter: "ansible_distribution*"
- name: Acquire Debian hosts
debug:
msg: "System is {{ansible_distribution}} {{ansible_distribution_version}}, checking in."
when:
- ansible_distribution == "Debian"
- ansible_distribution_version == "11" or ansible_distribution_version == "10" or ansible_distribution_version == "9"
changed_when: true
notify:
- "deb all"
handlers:
- name: Create ansible repository file
template:
src: "./debian-ansible-2.j2"
dest: "/etc/apt/sources.list.d/ansible-ubuntu.list"
owner: root
group: root
mode: "0644"
become: true
listen:
- "deb all"
- name: Import repository key
apt_key:
id: "{{ans.key.id}}"
keyserver: keyserver.ubuntu.com
state: "present"
become: true
listen: "deb all"
- name: Update apt cache
apt:
update_cache: "yes"
become: true
listen: "deb all"
- name: Remove ansible
# just upgrading stuff ended up in a broken installation due to a file being locked mutually between old
# and new package on debian 11. apt -f install fixed it without flaws, however - do we want that here? no.
apt:
name: "ansible"
state: "absent"
become: true
listen: "deb all"
when: ansible_distribution_version == "11"
- name: Install ansible (again)
apt:
name: "ansible"
state: "latest"
install_recommends: "yes"
become: true
listen: "deb all"
|