Skip to content

Instantly share code, notes, and snippets.

@hawaku
Last active August 29, 2015 14:13
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 hawaku/c654d4d7774c232ef523 to your computer and use it in GitHub Desktop.
Save hawaku/c654d4d7774c232ef523 to your computer and use it in GitHub Desktop.
AnsibleでNTP脆弱性に対応する ref: http://qiita.com/treeclad/items/2814a96a7cb9ec6dc392
- hosts: all
sudo: yes
gather_facts: no
vars:
pkg: ntp
tasks:
- name: yum clean
shell: yum clean all
- name: before-check
shell: yum list "{{pkg}}"
register: result
- debug: var=result.stdout_lines
- name: update "{{pkg}}"
yum: name="{{pkg}}" state=latest
- name: check again
shell: yum list "{{pkg}}"
register: result
- debug: var=result.stdout_lines
ansible-playbook -i inventory update.yml
ansible -i inventory all --sudo -m shell -a "yum clean all"
ansible -i inventory all --sudo -m shell -a "yum list ntp"
ansible -i inventory all --sudo -m shell -a "yum update ntp -y"
ansible -i inventory all --sudo -m shell -a "yum list ntp"
- hosts: all
sudo: yes
gather_facts: no
vars:
pkg: ntp
tasks:
- name: yum clean
shell: yum clean all
- name: before-check
shell: yum list "{{pkg}}"
register: result
- debug: var=result.stdout_lines
- name: update "{{pkg}}"
yum: name="{{pkg}}" state=latest
- name: check again
shell: yum list "{{pkg}}"
register: result
- debug: var=result.stdout_lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment