aboutsummaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-05-03 20:27:13 +0200
committerRomain Gonçalves <me@rgoncalves.se>2021-05-03 20:27:13 +0200
commit11fbaf0b558400264c95026c70ed938a97f1673d (patch)
treec92182e206c871ad09dd8e6a0ac34617122f5267 /roles
parent5d07c5c3ea19bf03232ab6c90c3176f1ab0388f2 (diff)
downloadold-infrastructure-11fbaf0b558400264c95026c70ed938a97f1673d.tar.gz
roles/update: Init default usages and actions
Diffstat (limited to 'roles')
-rw-r--r--roles/update/defaults/main.yml4
-rw-r--r--roles/update/tasks/_alpine.yml6
-rw-r--r--roles/update/tasks/_freebsd.yml11
-rw-r--r--roles/update/tasks/_freebsd_full.yml10
-rw-r--r--roles/update/tasks/_openbsd.yml10
-rw-r--r--roles/update/tasks/_openbsd_full.yml4
-rw-r--r--roles/update/tasks/main.yml12
7 files changed, 57 insertions, 0 deletions
diff --git a/roles/update/defaults/main.yml b/roles/update/defaults/main.yml
new file mode 100644
index 0000000..3b68610
--- /dev/null
+++ b/roles/update/defaults/main.yml
@@ -0,0 +1,4 @@
+
+update_reboot: false
+update_full: false
+update_version_freebsd: 13.0
diff --git a/roles/update/tasks/_alpine.yml b/roles/update/tasks/_alpine.yml
new file mode 100644
index 0000000..8f9a293
--- /dev/null
+++ b/roles/update/tasks/_alpine.yml
@@ -0,0 +1,6 @@
+---
+
+- name: update packages
+ shell: |
+ apk update
+ apk upgrade
diff --git a/roles/update/tasks/_freebsd.yml b/roles/update/tasks/_freebsd.yml
new file mode 100644
index 0000000..29d88ba
--- /dev/null
+++ b/roles/update/tasks/_freebsd.yml
@@ -0,0 +1,11 @@
+---
+
+- name: apply freebsd system updates
+ shell: |
+ freebsd-update --not-running-from-cron fetch
+ freebsd-update install
+
+- name: update freebsd packages
+ shell: |
+ pkg update
+ pkg upgrade
diff --git a/roles/update/tasks/_freebsd_full.yml b/roles/update/tasks/_freebsd_full.yml
new file mode 100644
index 0000000..0cfcfc9
--- /dev/null
+++ b/roles/update/tasks/_freebsd_full.yml
@@ -0,0 +1,10 @@
+---
+
+- name: upgrade freebsd to next release
+ shell: |
+ yes | freebsd-update update -r "{{ update_version_freebsd }}-RELEASE"
+
+- name: ensure packages are rebuild
+ shell: |
+ pkg-static -af
+ freebsd-update install
diff --git a/roles/update/tasks/_openbsd.yml b/roles/update/tasks/_openbsd.yml
new file mode 100644
index 0000000..9f0c1c5
--- /dev/null
+++ b/roles/update/tasks/_openbsd.yml
@@ -0,0 +1,10 @@
+---
+
+- name: update openbsd ports
+ shell: pkg_add -IUu
+
+- name: apply binary patches
+ shell: syspatch
+
+- name: cleanup unused packages
+ shell: pkg_delete -Iac
diff --git a/roles/update/tasks/_openbsd_full.yml b/roles/update/tasks/_openbsd_full.yml
new file mode 100644
index 0000000..9a73cfb
--- /dev/null
+++ b/roles/update/tasks/_openbsd_full.yml
@@ -0,0 +1,4 @@
+---
+
+- name: upgrade openbsd to next release
+ shell: sysupgrade
diff --git a/roles/update/tasks/main.yml b/roles/update/tasks/main.yml
new file mode 100644
index 0000000..8c5fed8
--- /dev/null
+++ b/roles/update/tasks/main.yml
@@ -0,0 +1,12 @@
+
+# update
+# update package to latest
+
+---
+
+- name: include per-distro update
+ include: "_{{ ansible_distribution | lower }}.yml"
+
+- name: include per-distro update-update/upgrade
+ include: "_{{ ansible_distribution | lower }}_full.yml"
+ when: update_full
remember that computers suck.