๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-playbooks/roles/common/tasks/debian.yml

53 lines
951 B

2 years ago
- name: set timezone
community.general.timezone:
name: "{{ timezone }}"
notify: restart crond
when: timezone is defined
- name: flush handlers
meta: flush_handlers
- name: update repository index
apt:
force_apt_get: yes
update_cache: yes
changed_when: false
- name: ensure apt-show-versions is installed
apt:
force_apt_get: yes
name: apt-show-versions
state: latest
- name: get upgradeable packages
shell:
cmd: apt-show-versions --upgradeable
register: upgradeable
changed_when: false
- block:
- name: pause and confirm updates
pause:
prompt: "{{ upgradeable.stdout }}"
- name: upgrade all packages
apt:
force_apt_get: yes
install_recommends: no
upgrade: dist
when: "(upgradeable.stdout_lines is defined) and (upgradeable.stdout_lines | length > 0)"
- name: clean repository cache
apt:
force_apt_get: yes
autoclean: yes
autoremove: yes