| 1234567891011121314151617181920212223242526272829303132 |
- ---
- - hosts: all
- gather_facts: yes
- become: yes
- tasks:
- - name: Perform a dist-upgrade.
- ansible.builtin.apt:
- upgrade: dist
- update_cache: yes
-
- - name: Install updates from pre-production systems
- apt:
- name: "{{ item.split('=')[0] }}"
- version: "{{ item.split('=')[1] }}"
- state: latest
- with_lines:
- - cat /local/path/to/updates.txt
- - name: Check if a reboot is required.
- ansible.builtin.stat:
- path: /var/run/reboot-required
- get_md5: no
- register: reboot_required_file
- - name: Reboot the server (if required).
- ansible.builtin.reboot:
- when: reboot_required_file.stat.exists == true
- - name: Remove dependencies that are no longer required.
- ansible.builtin.apt:
- autoremove: yes
|