test other version
Some checks failed
Ansible Minecraft CI/CD Pipeline / Ansible Lint Check (push) Successful in 58s
Ansible Minecraft CI/CD Pipeline / Project Structure Validation (push) Failing after 3s
Ansible Minecraft CI/CD Pipeline / Security Scan (push) Successful in 4s
Ansible Minecraft CI/CD Pipeline / Deploy to Staging (push) Has been skipped
Ansible Minecraft CI/CD Pipeline / Deploy to Production (push) Has been skipped
Ansible Minecraft CI/CD Pipeline / Backup System Check (push) Has been skipped
Some checks failed
Ansible Minecraft CI/CD Pipeline / Ansible Lint Check (push) Successful in 58s
Ansible Minecraft CI/CD Pipeline / Project Structure Validation (push) Failing after 3s
Ansible Minecraft CI/CD Pipeline / Security Scan (push) Successful in 4s
Ansible Minecraft CI/CD Pipeline / Deploy to Staging (push) Has been skipped
Ansible Minecraft CI/CD Pipeline / Deploy to Production (push) Has been skipped
Ansible Minecraft CI/CD Pipeline / Backup System Check (push) Has been skipped
This commit is contained in:
@@ -1,23 +1,41 @@
|
||||
---
|
||||
- name: Check for system updates (Debian/Ubuntu)
|
||||
apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
register: apt_cache_update
|
||||
- name: Update apt cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Check available upgrades
|
||||
shell: apt list --upgradable 2>/dev/null | grep -v WARNING | wc -l
|
||||
register: available_upgrades
|
||||
- name: Check for available system updates
|
||||
ansible.builtin.shell: |
|
||||
apt list --upgradable 2>/dev/null | grep -v "Listing..." | wc -l
|
||||
register: available_updates_count
|
||||
changed_when: false
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Apply system updates if available
|
||||
apt:
|
||||
upgrade: yes
|
||||
autoremove: yes
|
||||
autoclean: yes
|
||||
- name: Display available updates count
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ available_updates_count.stdout }} system updates available"
|
||||
when: available_updates_count is defined
|
||||
|
||||
- name: Apply system updates if auto-update enabled
|
||||
ansible.builtin.apt:
|
||||
upgrade: dist
|
||||
autoremove: true
|
||||
autoclean: true
|
||||
when:
|
||||
- system_update_auto | bool
|
||||
- ansible_os_family == "Debian"
|
||||
- available_upgrades.stdout | int > 1
|
||||
notify: reboot if needed
|
||||
- available_updates_count.stdout | int > 0
|
||||
register: system_update_result
|
||||
|
||||
- name: Check if reboot is required
|
||||
ansible.builtin.stat:
|
||||
path: /var/run/reboot-required
|
||||
register: reboot_required_file
|
||||
when: system_reboot_required_check | bool
|
||||
|
||||
- name: Warn about required reboot
|
||||
ansible.builtin.debug:
|
||||
msg: "ATTENTION: System reboot is required to complete updates"
|
||||
when:
|
||||
- reboot_required_file is defined
|
||||
- reboot_required_file.stat.exists
|
Reference in New Issue
Block a user