aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
m---------ansible/kubespray0
-rw-r--r--ansible/playbooks/apt_update.yml12
-rw-r--r--ansible/playbooks/update_system.yml7
-rw-r--r--ansible/roles/update_system/tasks/main.yml16
5 files changed, 24 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index f0ae383..9709716 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@ inventory.ini
# Ansible
*.retry
+inventory.yaml
# Packer
packer_cache/
diff --git a/ansible/kubespray b/ansible/kubespray
-Subproject 2ae66bb366b02b71109f04dd011d1f2435e5cb4
+Subproject b9bedb06b7866efdc9e8baec45b826042ae5a0f
diff --git a/ansible/playbooks/apt_update.yml b/ansible/playbooks/apt_update.yml
deleted file mode 100644
index 2724a30..0000000
--- a/ansible/playbooks/apt_update.yml
+++ /dev/null
@@ -1,12 +0,0 @@
----
-- name: Update the server
- hosts: vps
- become: true
- tasks:
-
- - name: Update and upgrade apt packages
- ansible.builtin.apt:
- update_cache: true
- upgrade: true
- autoremove: true
-...
diff --git a/ansible/playbooks/update_system.yml b/ansible/playbooks/update_system.yml
new file mode 100644
index 0000000..ba3fb84
--- /dev/null
+++ b/ansible/playbooks/update_system.yml
@@ -0,0 +1,7 @@
+---
+- name: Update the server
+ hosts: all
+ become: true
+ roles:
+ - update_system
+...
diff --git a/ansible/roles/update_system/tasks/main.yml b/ansible/roles/update_system/tasks/main.yml
new file mode 100644
index 0000000..6195d64
--- /dev/null
+++ b/ansible/roles/update_system/tasks/main.yml
@@ -0,0 +1,16 @@
+---
+- name: Update and upgrade system packages (Debian-based)
+ ansible.builtin.apt:
+ update_cache: true
+ upgrade: true
+ autoremove: true
+ when: ansible_pkg_mgr == "apt"
+
+- name: Update and upgrade system packages (RedHat-based)
+ ansible.builtin.dnf:
+ update_cache: true
+ name: "*"
+ state: present
+ autoremove: true
+ when: ansible_pkg_mgr == "dnf"
+...