summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2026-05-06 09:24:02 -0400
committerFreya Murphy <freya@freyacat.org>2026-05-06 09:24:02 -0400
commit59e6320ac86ad1dcf595b4d558c24a1aba84db77 (patch)
treed7623c5cb3554cba9e28f50ab75fb43dcbc6f22b /roles
parentadd network configuration (diff)
downloadansible-59e6320ac86ad1dcf595b4d558c24a1aba84db77.tar.gz
ansible-59e6320ac86ad1dcf595b4d558c24a1aba84db77.tar.bz2
ansible-59e6320ac86ad1dcf595b4d558c24a1aba84db77.zip
improve repos / add update for debian
Diffstat (limited to 'roles')
-rw-r--r--roles/debian/files/jenkins.sources5
-rw-r--r--roles/debian/tasks/sources.yml56
-rw-r--r--roles/debian/templates/adoptium.sources.j25
-rw-r--r--roles/update/tasks/debian.yml16
4 files changed, 80 insertions, 2 deletions
diff --git a/roles/debian/files/jenkins.sources b/roles/debian/files/jenkins.sources
new file mode 100644
index 0000000..e888bab
--- /dev/null
+++ b/roles/debian/files/jenkins.sources
@@ -0,0 +1,5 @@
+Types: deb
+URIs: https://pkg.jenkins.io/debian-stable/
+Suites: binary/
+Components:
+Signed-By: /usr/share/keyrings/jenkins-keyring.asc
diff --git a/roles/debian/tasks/sources.yml b/roles/debian/tasks/sources.yml
index f3bb287..b6457a5 100644
--- a/roles/debian/tasks/sources.yml
+++ b/roles/debian/tasks/sources.yml
@@ -1,4 +1,6 @@
-- name: Configure APT repositories
+# Setup Debian
+
+- name: Configure Debian APT repositories
template:
src: debian.sources.j2
dest: /etc/apt/sources.list.d/debian.sources
@@ -6,5 +8,55 @@
group: root
mode: '0644'
+# 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
- command: apt update
+ apt:
+ update_cache: yes
+
diff --git a/roles/debian/templates/adoptium.sources.j2 b/roles/debian/templates/adoptium.sources.j2
new file mode 100644
index 0000000..89479de
--- /dev/null
+++ b/roles/debian/templates/adoptium.sources.j2
@@ -0,0 +1,5 @@
+Types: deb
+URIs: https://packages.adoptium.net/artifactory/deb/
+Suites: {{ debian_version }}
+Components: main
+Signed-By: /usr/share/keyrings/adoptium.asc
diff --git a/roles/update/tasks/debian.yml b/roles/update/tasks/debian.yml
new file mode 100644
index 0000000..4b98462
--- /dev/null
+++ b/roles/update/tasks/debian.yml
@@ -0,0 +1,16 @@
+- name: Ensure repositories are configured
+ include_role:
+ name: debian
+ tasks_from: sources
+
+- name: Upgrade all packages
+ apt:
+ upgrade: dist
+
+- name: Remove unused packages
+ apt:
+ autoremove: yes
+
+- name: Clean apt cache
+ apt:
+ autoclean: yes