feat: move tags around

This commit is contained in:
Simon Cornet 2025-10-23 10:26:28 +02:00
commit 4edcb29499
3 changed files with 53 additions and 49 deletions

View file

@ -2,10 +2,8 @@
# install updates # install updates
- name: "install updates" - name: "install updates"
tags: "update"
ansible.builtin.include_tasks: "update.yaml" ansible.builtin.include_tasks: "update.yaml"
# initiate reboot # initiate reboot
- name: "initiate rboot" - name: "initiate reboot"
tags: "reboot"
ansible.builtin.include_tasks: "reboot.yaml" ansible.builtin.include_tasks: "reboot.yaml"

View file

@ -2,6 +2,7 @@
# reboot the system # reboot the system
- name: "reboot the system" - name: "reboot the system"
tags: "reboot"
ansible.builtin.reboot: ansible.builtin.reboot:
msg: "Reboot initiated by Ansible" msg: "Reboot initiated by Ansible"
reboot_timeout: 120 reboot_timeout: 120

View file

@ -1,61 +1,66 @@
--- ---
# install updates - debian # install updates
- name: "install updates - debian"
when: 'ansible_os_family == "Debian"'
block:
# install updates
- name: "install updates - debian"
ansible.builtin.apt:
autoremove: true
update_cache: true
upgrade: "safe"
# clean cache
- name: "clean cache - debian"
ansible.builtin.apt:
clean: true
# install updates - rhel
- name: "install updates - rhel"
when: 'ansible_os_family == "RedHat"'
block:
# install updates
- name: "install updates - rhel"
ansible.builtin.dnf:
name: "*"
state: "latest"
update_cache: true
# autoremove
- name: "autoremove unused packages - rhel"
ansible.builtin.dnf:
autoremove: true
# clean cache
- name: "clean cache - rhel"
ansible.builtin.command:
cmd: "dnf clean all"
changed_when: false
# install updates - suse
- name: "install updates" - name: "install updates"
when: 'ansible_os_family == "Suse"' tags: "update"
block: block:
# install updates # install updates - debian
- name: "install updates - suse" - name: "install updates - debian"
community.general.zypper: when: 'ansible_os_family == "Debian"'
name: "*" block:
state: "latest"
update_cache: true
# clean cache # install updates
- name: "clean cache - suse" - name: "install updates - debian"
ansible.builtin.command: ansible.builtin.apt:
cmd: "zypper clean --all" autoremove: true
changed_when: false update_cache: true
upgrade: "safe"
# clean cache
- name: "clean cache - debian"
ansible.builtin.apt:
clean: true
# install updates - rhel
- name: "install updates - rhel"
when: 'ansible_os_family == "RedHat"'
block:
# install updates
- name: "install updates - rhel"
ansible.builtin.dnf:
name: "*"
state: "latest"
update_cache: true
# autoremove
- name: "autoremove unused packages - rhel"
ansible.builtin.dnf:
autoremove: true
# clean cache
- name: "clean cache - rhel"
ansible.builtin.command:
cmd: "dnf clean all"
changed_when: false
# install updates - suse
- name: "install updates"
when: 'ansible_os_family == "Suse"'
block:
# install updates
- name: "install updates - suse"
community.general.zypper:
name: "*"
state: "latest"
update_cache: true
# clean cache
- name: "clean cache - suse"
ansible.builtin.command:
cmd: "zypper clean --all"
changed_when: false