diff --git a/playbooks/update.yml b/playbooks/update.yml new file mode 100644 index 0000000..c644cea --- /dev/null +++ b/playbooks/update.yml @@ -0,0 +1,26 @@ +--- +- name: System update for all managed hosts + hosts: all + become: yes + gather_facts: yes # для получения информации о дистрибутиве + + tasks: + - name: Update apt cache (Debian/Ubuntu) + apt: + update_cache: yes + cache_valid_time: 3600 # не обновлять кэш, если он свежее 1 часа + when: ansible_os_family == "Debian" + + - name: Perform dist-upgrade (full upgrade) + apt: + upgrade: dist + autoremove: yes + autoclean: yes + when: ansible_os_family == "Debian" + + # - name: Reboot if required (optional) + # reboot: + # reboot_timeout: 600 + # pre_reboot_delay: 30 + # post_reboot_delay: 30 + # when: ansible_os_family == "Debian" and ansible_distribution_version is version('10', '>=') \ No newline at end of file