Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. # {{ansible_managed}}
  2. 127.0.0.1 localhost.localdomain localhost
  3.  
  4.  
  5.  
  6. {% for item in groups['all'] %}
  7. {{ hostvars[item]['ansible_default_ipv4']['address'] }} {{ item }} {{ item }}.site.com
  8. {% endfor %}
  9.  
  10. ----------- cut --------------------------------
  11.  
  12. this is a hosts.j2 tempalte file that goes under tempalte folder.
  13.  
  14. i call the role like this
  15.  
  16. ---
  17. - name: Cleanup VM
  18. hosts: cleanup
  19. remote_user: root
  20. roles:
  21. - cleanup
  22.  
  23. - name: Install Common
  24. hosts: all
  25. remote_user: root
  26. roles:
  27. - common
  28.  
  29. - name: Install hosts configuration
  30. hosts: all
  31. remote_user: root
  32. roles:
  33. - hosts
  34.  
  35. (...)
  36.  
  37. i have other stuff there but it breaks on the hosts role.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement