Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. # vim: ft=ansible
  2. #
  3. # usage:
  4. #
  5. # ansible-playbook -i <path/to/inventory> update_hosts.yml --ask-become-pass
  6. #
  7. #
  8. - hosts: all
  9. gather_facts: no
  10. sudo: yes
  11. connection: local
  12. tasks:
  13. - name: "Build hosts file"
  14. lineinfile:
  15. dest: /etc/hosts
  16. regexp: '.*{{ inventory_hostname }}$'
  17. line: "{{ ansible_ssh_host }} {{ inventory_hostname }}"
  18. state: present
  19. delegate_to: localhost
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement