main.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ---
  2. - name: Check for NetworkManager service
  3. command: >
  4. systemctl show NetworkManager
  5. register: nm_show
  6. changed_when: false
  7. ignore_errors: True
  8. - name: Set fact using_network_manager
  9. set_fact:
  10. network_manager_active: "{{ True if 'ActiveState=active' in nm_show.stdout else False }}"
  11. - name: Install dnsmasq
  12. package: name=dnsmasq state=installed
  13. when: not openshift.common.is_atomic | bool
  14. - name: Install dnsmasq configuration
  15. template:
  16. src: origin-dns.conf.j2
  17. dest: /etc/dnsmasq.d/origin-dns.conf
  18. notify: restart dnsmasq
  19. - name: Deploy additional dnsmasq.conf
  20. template:
  21. src: "{{ openshift_node_dnsmasq_additional_config_file }}"
  22. dest: /etc/dnsmasq.d/openshift-ansible.conf
  23. owner: root
  24. group: root
  25. mode: 0644
  26. when: openshift_node_dnsmasq_additional_config_file is defined
  27. notify: restart dnsmasq
  28. - name: Enable dnsmasq
  29. systemd:
  30. name: dnsmasq
  31. enabled: yes
  32. state: started
  33. # Dynamic NetworkManager based dispatcher
  34. - include: ./network-manager.yml
  35. when: network_manager_active | bool
  36. # Relies on ansible in order to configure static config
  37. - include: ./no-network-manager.yml
  38. when: not network_manager_active | bool