2
0
This commit is contained in:
2024-06-06 18:47:45 +02:00
parent 9f676662c4
commit 8815c2027d
2 changed files with 10 additions and 11 deletions

View File

@@ -2,10 +2,14 @@
- name: Reboot machine
hosts: "{{ Daily_Reboot_Hosts }}"
become: yes
become_method: sudo
tasks:
- name: Reboot machine
become: yes
ansible.builtin.reboot:
reboot_timeout: 3600
msg: "Automatic reboot initiated"
command: /sbin/reboot
async: 1
poll: 0
when: reboot.stat.exists == true
- name: Wait for systems to become reachable
wait_for_connection:

View File

@@ -1,32 +1,27 @@
---
- name: Update and upgrade apt packages
hosts: all
become: true
become: yes
become_method: sudo
tasks:
- name: Update packages with apt
when: ansible_pkg_mgr == 'apt'
become: true
apt:
update_cache: true
- name: Upgrade packages with apt
when: ansible_pkg_mgr == 'apt'
become: true
command: sudo apt-get upgrade -y
- name: Update packages with yum
when: ansible_pkg_mgr == 'yum'
become: true
become_method: sudo
ansible.builtin.yum:
name: '*'
state: latest # noqa: package-latest
- name: Upgrade packages with yum
when: ansible_pkg_mgr == 'yum'
become: true
become_method: sudo
ansible.builtin.yum:
name: '*'
state: latest # noqa: package-latest