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 - name: Reboot machine
hosts: "{{ Daily_Reboot_Hosts }}" hosts: "{{ Daily_Reboot_Hosts }}"
become: yes become: yes
become_method: sudo
tasks: tasks:
- name: Reboot machine - name: Reboot machine
become: yes command: /sbin/reboot
ansible.builtin.reboot: async: 1
reboot_timeout: 3600 poll: 0
msg: "Automatic reboot initiated" 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 - name: Update and upgrade apt packages
hosts: all hosts: all
become: true become: yes
become_method: sudo
tasks: tasks:
- name: Update packages with apt - name: Update packages with apt
when: ansible_pkg_mgr == 'apt' when: ansible_pkg_mgr == 'apt'
become: true
apt: apt:
update_cache: true update_cache: true
- name: Upgrade packages with apt - name: Upgrade packages with apt
when: ansible_pkg_mgr == 'apt' when: ansible_pkg_mgr == 'apt'
become: true
command: sudo apt-get upgrade -y command: sudo apt-get upgrade -y
- name: Update packages with yum - name: Update packages with yum
when: ansible_pkg_mgr == 'yum' when: ansible_pkg_mgr == 'yum'
become: true
become_method: sudo
ansible.builtin.yum: ansible.builtin.yum:
name: '*' name: '*'
state: latest # noqa: package-latest state: latest # noqa: package-latest
- name: Upgrade packages with yum - name: Upgrade packages with yum
when: ansible_pkg_mgr == 'yum' when: ansible_pkg_mgr == 'yum'
become: true
become_method: sudo
ansible.builtin.yum: ansible.builtin.yum:
name: '*' name: '*'
state: latest # noqa: package-latest state: latest # noqa: package-latest