Skip to content

Instantly share code, notes, and snippets.

@thefaxe
Created February 21, 2020 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefaxe/1cf058ad748c2c39619ec1784acd8293 to your computer and use it in GitHub Desktop.
Save thefaxe/1cf058ad748c2c39619ec1784acd8293 to your computer and use it in GitHub Desktop.
dirty ansible update-script for centos and debian
- hosts: debian
remote_user: ansible
become: yes
become_user: root
tasks:
- name: update debian
apt:
upgrade: yes
update_cache: yes
cache_valid_time: 86400 #One day
when: ansible_os_family == 'Debian'
- name: dist-update debian
apt:
upgrade: dist
update_cache: yes
cache_valid_time: 86400 #One day
when: ansible_os_family == 'Debian'
- name: autoclean
command: apt-get autoremove -y
- hosts: centos
remote_user: ansible
become: yes
become_user: root
tasks:
- name: update local Centos
yum: name=* state=latest
when: ansible_os_family == 'RedHat'
- name: neustart
command: shutdown -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment