Browse Source

add update playbook to allow updating host through ansible

master
LecygneNoir 9 years ago
parent
commit
9f786dad6b
6 changed files with 68 additions and 0 deletions
  1. +4
    -0
      README.md
  2. +7
    -0
      roles/update/defaults/main.yml
  3. +15
    -0
      roles/update/tasks/by_packages.yml
  4. +12
    -0
      roles/update/tasks/main.yml
  5. +17
    -0
      roles/update/tasks/normal.yml
  6. +13
    -0
      update.yml

+ 4
- 0
README.md View File

@ -9,6 +9,10 @@ roles
* Common
* provides **common** configuration
* https://github.com/nojhan/liquidprompt <3
* Update
* allow install all update on hosts (tag normal)
* allow update specific packages from list (tags packages)
* use host_vars, group_vars or default vars to update packages list
* Wallabag
* provides **Wallabag** configuration
* Imported with <3 from https://github.com/al3x/sovereign/

+ 7
- 0
roles/update/defaults/main.yml View File

@ -0,0 +1,7 @@
---
deb_packages_to_update:
- wget
centos_packages_to_update:
- vim

+ 15
- 0
roles/update/tasks/by_packages.yml View File

@ -0,0 +1,15 @@
---
- name: debian update package
tags: packages
apt: pkg={{item}} state=latest update_cache=yes
with_items: deb_packages_to_update
when: ansible_distribution == 'Debian'
- name: centos update packages
tags: packages
yum: name={{item}} state=latest update_cache=yes
with_items: yum_packages_to_update
when: ansible_distribution == 'CentOS' or ansible_distribution == 'CloudLinux'

+ 12
- 0
roles/update/tasks/main.yml View File

@ -0,0 +1,12 @@
---
- include: normal.yml
- include: by_packages.yml
- name: ldconfig
tags:
- normal
- packages
- ldconfig
shell: ldconfig

+ 17
- 0
roles/update/tasks/normal.yml View File

@ -0,0 +1,17 @@
---
- name: apt-get update
tags: normal
apt: update_cache=yes
ignore_errors: no
when: ansible_distribution == 'Debian'
- name: apt-get upgrade (safe)
tags: normal
apt: upgrade=safe # http://docs.ansible.com/apt_module.html
when: ansible_distribution == 'Debian'
- name: yum update
tags: normal
yum: name=* state=latest
when: ansible_distribution == 'CentOS' or ansible_distribution == 'CloudLinux'

+ 13
- 0
update.yml View File

@ -0,0 +1,13 @@
---
- name: Update host --- tags - grsec, init, normal
hosts: all
user: root
gather_facts: yes
serial: 1
max_fail_percentage: 1
roles:
- role: update

Loading…
Cancel
Save