main.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. - yum:
  3. name: openshift-ansible-inventory
  4. state: present
  5. - template:
  6. src: multi_ec2.yaml.j2
  7. dest: /etc/ansible/multi_ec2.yaml
  8. group: "{{ oo_inventory_group }}"
  9. owner: "{{ oo_inventory_owner }}"
  10. mode: "0640"
  11. - file:
  12. state: directory
  13. dest: /etc/ansible/inventory
  14. owner: root
  15. group: libra_ops
  16. mode: 0750
  17. - file:
  18. state: link
  19. src: /usr/share/ansible/inventory/multi_ec2.py
  20. dest: /etc/ansible/inventory/multi_ec2.py
  21. owner: root
  22. group: libra_ops
  23. # This cron uses the above location to call its job
  24. - name: Cron to keep cache fresh
  25. cron:
  26. name: 'multi_ec2_inventory'
  27. minute: '*/10'
  28. job: '/usr/share/ansible/inventory/multi_ec2.py --refresh-cache &> /dev/null'
  29. when: oo_cron_refresh_cache is defined and oo_cron_refresh_cache
  30. - lineinfile:
  31. dest: /etc/ansible/ansible.cfg
  32. backrefs: yes
  33. regexp: '^(hostfile|inventory)( *)='
  34. line: '\1\2= /etc/ansible/inventory'
  35. - name: setting ec2.ini destination_format
  36. lineinfile:
  37. dest: /usr/share/ansible/inventory/aws/ec2.ini
  38. regexp: '^destination_format *='
  39. line: "destination_format = {{ oo_ec2_destination_format }}"
  40. when: oo_ec2_destination_format is defined
  41. - name: setting ec2.ini destination_format_tags
  42. lineinfile:
  43. dest: /usr/share/ansible/inventory/aws/ec2.ini
  44. regexp: '^destination_format_tags *='
  45. line: "destination_format_tags = {{ oo_ec2_destination_format_tags }}"
  46. when: oo_ec2_destination_format_tags is defined
  47. - name: Set cache location
  48. file:
  49. state: directory
  50. dest: "{{ oo_inventory_cache_location | dirname }}"
  51. owner: root
  52. group: libra_ops
  53. recurse: yes
  54. mode: '2750'
  55. when: oo_inventory_cache_location is defined