CSC Ansible Playbooks
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.

18 lines
777 B

- hosts: all
become: yes
become_method: sudo
- name: update hosts
connection: local
git: repo=~git/public/hosts.git dest=/tmp/generate-hosts-{{ ansible_hostname }}
- name: generate hosts file
connection: local
shell: /tmp/generate-hosts-{{ ansible_hostname }}/ < /tmp/generate-hosts-{{ ansible_hostname }}/ > /tmp/generate-hosts-{{ ansible_hostname }}/hosts
- name: copy hosts file
copy: src=/tmp/generate-hosts-{{ ansible_hostname }}/hosts dest=/etc/hosts backup=no
- name: etckeeper commit
command: etckeeper commit "Update /etc/hosts with ansible"
- name: delete local copy
connection: local
command: rm -rf /tmp/generate-hosts-{{ ansible_hostname }}