summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node/tasks
diff options
context:
space:
mode:
authorMichael Gugino <gugino.michael@yahoo.com>2017-11-28 10:34:12 -0500
committerGitHub <noreply@github.com>2017-11-28 10:34:12 -0500
commitb9ab765528ff2e7f9aa46b6942d74027ef9b6799 (patch)
tree446766a541618590b79ff263e5edc5de580ec25a /roles/openshift_node/tasks
parentc7645af60a5411af83b04fb6a5617887d3b39183 (diff)
parent73bf3e7137d80ba5b225108f39240c43d385a1ea (diff)
downloadopenshift-b9ab765528ff2e7f9aa46b6942d74027ef9b6799.tar.gz
openshift-b9ab765528ff2e7f9aa46b6942d74027ef9b6799.tar.bz2
openshift-b9ab765528ff2e7f9aa46b6942d74027ef9b6799.tar.xz
openshift-b9ab765528ff2e7f9aa46b6942d74027ef9b6799.zip
Merge pull request #6268 from mgugino-upstream-stage/combine-dnsmasq-with-node
Combine openshift_node and openshift_node_dnsmasq
Diffstat (limited to 'roles/openshift_node/tasks')
-rw-r--r--roles/openshift_node/tasks/dnsmasq.yml67
-rw-r--r--roles/openshift_node/tasks/dnsmasq/network-manager.yml10
-rw-r--r--roles/openshift_node/tasks/dnsmasq/no-network-manager.yml11
-rw-r--r--roles/openshift_node/tasks/main.yml2
-rw-r--r--roles/openshift_node/tasks/upgrade.yml3
5 files changed, 91 insertions, 2 deletions
diff --git a/roles/openshift_node/tasks/dnsmasq.yml b/roles/openshift_node/tasks/dnsmasq.yml
new file mode 100644
index 000000000..22bdce6c6
--- /dev/null
+++ b/roles/openshift_node/tasks/dnsmasq.yml
@@ -0,0 +1,67 @@
+---
+- 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: ensure origin/node directory exists
+ file:
+ state: directory
+ path: "{{ item }}"
+ owner: root
+ group: root
+ mode: '0700'
+ with_items:
+ - /etc/origin
+ - /etc/origin/node
+
+# this file is copied to /etc/dnsmasq.d/ when the node starts and is removed
+# when the node stops. A dbus-message is sent to dnsmasq to add the same entries
+# so that dnsmasq doesn't need to be restarted. Once we can use dnsmasq 2.77 or
+# newer we can use --server-file option to update the servers dynamically and
+# reload them by sending dnsmasq a SIGHUP. We write the file in case someone else
+# triggers a restart of dnsmasq but not a node restart.
+- name: Install node-dnsmasq.conf
+ template:
+ src: node-dnsmasq.conf.j2
+ dest: /etc/origin/node/node-dnsmasq.conf
+
+- 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
+ systemd:
+ name: dnsmasq
+ enabled: yes
+ state: started
+
+# Dynamic NetworkManager based dispatcher
+- include_tasks: dnsmasq/network-manager.yml
+ when: network_manager_active | bool
+
+# Relies on ansible in order to configure static config
+- include_tasks: dnsmasq/no-network-manager.yml
+ when: not network_manager_active | bool
diff --git a/roles/openshift_node/tasks/dnsmasq/network-manager.yml b/roles/openshift_node/tasks/dnsmasq/network-manager.yml
new file mode 100644
index 000000000..e5a92a630
--- /dev/null
+++ b/roles/openshift_node/tasks/dnsmasq/network-manager.yml
@@ -0,0 +1,10 @@
+---
+- name: Install network manager dispatch script
+ copy:
+ src: networkmanager/99-origin-dns.sh
+ dest: /etc/NetworkManager/dispatcher.d/
+ mode: 0755
+ notify: restart NetworkManager
+ when: openshift_node_dnsmasq_install_network_manager_hook | default(true) | bool
+
+- meta: flush_handlers
diff --git a/roles/openshift_node/tasks/dnsmasq/no-network-manager.yml b/roles/openshift_node/tasks/dnsmasq/no-network-manager.yml
new file mode 100644
index 000000000..dede2fb8f
--- /dev/null
+++ b/roles/openshift_node/tasks/dnsmasq/no-network-manager.yml
@@ -0,0 +1,11 @@
+---
+- fail: msg="Currently, NetworkManager must be installed and enabled prior to installation."
+ when: not openshift_node_bootstrap | bool
+
+- name: Install NetworkManager during node_bootstrap provisioning
+ package:
+ name: NetworkManager
+ state: present
+ notify: restart NetworkManager
+
+- include_tasks: network-manager.yml
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml
index 8e9d1d1b5..d46b1f9c3 100644
--- a/roles/openshift_node/tasks/main.yml
+++ b/roles/openshift_node/tasks/main.yml
@@ -6,6 +6,8 @@
- deployment_type == 'openshift-enterprise'
- not openshift_use_crio | default(false)
+- include: dnsmasq.yml
+
- name: setup firewall
import_tasks: firewall.yml
diff --git a/roles/openshift_node/tasks/upgrade.yml b/roles/openshift_node/tasks/upgrade.yml
index fb21b39a1..ff3478800 100644
--- a/roles/openshift_node/tasks/upgrade.yml
+++ b/roles/openshift_node/tasks/upgrade.yml
@@ -179,5 +179,4 @@
retries: 24
delay: 5
-- include_role:
- name: openshift_node_dnsmasq
+- include_tasks: dnsmasq.yml