aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--playbooks/update.yml8
-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
8 files changed, 63 insertions, 2 deletions
diff --git a/playbooks/update.yml b/playbooks/update.yml
index ca2587e..f9399cb 100644
--- a/playbooks/update.yml
+++ b/playbooks/update.yml
@@ -3,9 +3,13 @@
---
-- name: Updates all instances with latest packages from their distribution repositories
+- hosts: servers
strategy: free
- hosts: servers
roles:
- update
+- hosts: servers
+ tasks:
+ - name: reboot all servers
+ reboot:
+ when: update_reboot is defined and update_reboot
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.