netmaster.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ---
  2. - include: netmaster_firewalld.yml
  3. when: has_firewalld
  4. - include: netmaster_iptables.yml
  5. when: not has_firewalld and has_iptables
  6. - name: Netmaster | Check is /etc/hosts file exists
  7. stat:
  8. path: /etc/hosts
  9. register: hosts
  10. - name: Netmaster | Create hosts file if it is not present
  11. file:
  12. path: /etc/hosts
  13. state: touch
  14. when: not hosts.stat.exists
  15. - name: Netmaster | Build hosts file
  16. lineinfile:
  17. dest: /etc/hosts
  18. regexp: .*netmaster$
  19. line: "{{ hostvars[item]['ansible_' + netmaster_interface].ipv4.address }} netmaster"
  20. state: present
  21. when: hostvars[item]['ansible_' + netmaster_interface].ipv4.address is defined
  22. with_items: groups['masters']
  23. - name: Netmaster | Create netmaster symlinks
  24. file:
  25. src: "{{ contiv_current_release_directory }}/{{ item }}"
  26. dest: "{{ bin_dir }}/{{ item }}"
  27. state: link
  28. with_items:
  29. - netmaster
  30. - netctl
  31. - name: Netmaster | Copy environment file for netmaster
  32. template:
  33. src: netmaster.env.j2
  34. dest: /etc/default/netmaster
  35. mode: 0644
  36. notify: restart netmaster
  37. - name: Netmaster | Copy systemd units for netmaster
  38. template:
  39. src: netmaster.service
  40. dest: /etc/systemd/system/netmaster.service
  41. notify: reload systemd
  42. - name: Netmaster | Enable Netmaster
  43. service:
  44. name: netmaster
  45. enabled: yes
  46. - name: Netmaster | Start Netmaster
  47. service:
  48. name: netmaster
  49. state: started
  50. register: netmaster_started
  51. - include: aci.yml
  52. when: contiv_fabric_mode == "aci"
  53. - include: default_network.yml
  54. when: contiv_default_network == true