---
- name: Check for NetworkManager service
  command: >
    systemctl show NetworkManager
  register: nm_show
  changed_when: false

- name: Set fact using_network_manager
  set_fact:
    network_manager_active: "{{ True if 'ActiveState=active' in nm_show.stdout else False }}"

- name: Install dnsmasq
  package: name=dnsmasq state=installed
  when: not openshift.common.is_atomic | bool

- name: Install dnsmasq configuration
  template:
    src: origin-dns.conf.j2
    dest: /etc/dnsmasq.d/origin-dns.conf
  notify: restart dnsmasq

- name: Deploy additional dnsmasq.conf
  template:
   src: "{{ openshift_node_dnsmasq_additional_config_file }}"
   dest: /etc/dnsmasq.d/openshift-ansible.conf
   owner: root
   group: root
   mode: 0644
  when: openshift_node_dnsmasq_additional_config_file is defined
  notify: restart dnsmasq

- name: Enable dnsmasq
  service:
    name: dnsmasq
    enabled: yes
    state: started

# Dynamic NetworkManager based dispatcher
- include: ./network-manager.yml
  when: network_manager_active | bool

# Relies on ansible in order to configure static config
- include: ./no-network-manager.yml
  when: not network_manager_active | bool

---
- name: Check for NetworkManager service
  command: >
    systemctl show NetworkManager
  register: nm_show
  changed_when: false
  ignore_errors: True

- name: Set fact using_network_manager
  set_fact:
    network_manager_active: "{{ True if 'ActiveState=active' in nm_show.stdout else False }}"

- name: Install dnsmasq
  package: name=dnsmasq state=installed
  when: not openshift.common.is_atomic | bool

- name: Install dnsmasq configuration
  template:
    src: origin-dns.conf.j2
    dest: /etc/dnsmasq.d/origin-dns.conf
  notify: restart dnsmasq

- name: Deploy additional dnsmasq.conf
  template:
   src: "{{ openshift_node_dnsmasq_additional_config_file }}"
   dest: /etc/dnsmasq.d/openshift-ansible.conf
   owner: root
   group: root
   mode: 0644
  when: openshift_node_dnsmasq_additional_config_file is defined
  notify: restart dnsmasq

- name: Enable dnsmasq
  service:
    name: dnsmasq
    enabled: yes
    state: started

# Dynamic NetworkManager based dispatcher
- include: ./network-manager.yml
  when: network_manager_active | bool

# Relies on ansible in order to configure static config
- include: ./no-network-manager.yml
  when: not network_manager_active | bool

Make the role work on F25 Cloud
Make the role work on F25 Cloud

On F24 and earlier, systemctl show always returned 0. On F25, it
return 1 when a service do not exist, and thus the role fail
on Fedora 25 cloud edition.
