main.yml 1.1 KB

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