---
- 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: present
  register: result
  until: result is succeeded
  when: not openshift_is_atomic | bool

- name: ensure origin/node directory exists
  file:
    state: directory
    path: "{{ item }}"
    owner: root
    group: root
    mode: '0700'
  with_items:
  - /etc/origin
  - /etc/origin/node

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