summaryrefslogtreecommitdiff
path: root/roles/debian/tasks/sources.yml
blob: 813c3db224fcdff1eb0f68ab8331db50c5734b2b (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
72
73
74
75
76
77
# Setup Debian

- name: Check for modern sources
  stat:
    path: /etc/apt/sources.list.d/debian.sources
  register: modern

- name: Configure Debian APT repositories (modern)
  template:
    src: debian.sources.j2
    dest: /etc/apt/sources.list.d/debian.sources
    owner: root
    group: root
    mode: '0644'
  when: modern.stat.exists

- name: Configure Debian APT repositories (legacy)
  template:
    src: sources.list.j2
    dest: /etc/apt/sources.list
    owner: root
    group: root
    mode: '0644'
  when: not modern.stat.exists

# Setup Adoptium

- name: Check for adoptium repo
  stat:
    path: /etc/apt/sources.list.d/adoptium.sources
  register: adoptium

- name: Configure Adoptium APT repositories
  template:
    src: adoptium.sources.j2
    dest: /etc/apt/sources.list.d/adoptium.sources
    owner: root
    group: root
    mode: '0644'
  when: adoptium.stat.exists or apt_adoptium is defined

- name: Install Adoptium GPG key
  get_url:
    url: https://packages.adoptium.net/artifactory/api/gpg/key/public
    dest: /usr/share/keyrings/adoptium.asc
    mode: '0644'
  when: adoptium.stat.exists or apt_adoptium is defined

# Setup Jenkins

- name: Check for jenkins repo
  stat:
    path: /etc/apt/sources.list.d/jenkins.sources
  register: jenkins

- name: Configure Jenkins APT repositories
  copy:
    src: jenkins.sources
    dest: /etc/apt/sources.list.d/jenkins.sources
    owner: root
    group: root
    mode: '0664'
  when: jenkins.stat.exists or apt_jenkins is defined

- name: Install Jenkins GPG key
  get_url:
    url: https://pkg.jenkins.io/debian-stable/jenkins.io-2026.key
    dest: /usr/share/keyrings/jenkins-keyring.asc
    mode: '0644'
  when: jenkins.stat.exists or apt_jenkins is defined

# Finally update apt

- name: Update APT cache
  apt:
    update_cache: yes