summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorAndrew Butcher <abutcher@redhat.com>2016-11-21 10:47:23 -0500
committerAndrew Butcher <abutcher@redhat.com>2016-11-21 10:47:23 -0500
commit448c33754c7b5e7cde997a20e137825e85dde6d2 (patch)
treec9761166d2af811588c91c413ed444bbc60f1020 /roles
parentfbe096eb1e1da94d0a1b9aae55c28db3277c0191 (diff)
downloadopenshift-448c33754c7b5e7cde997a20e137825e85dde6d2.tar.gz
openshift-448c33754c7b5e7cde997a20e137825e85dde6d2.tar.bz2
openshift-448c33754c7b5e7cde997a20e137825e85dde6d2.tar.xz
openshift-448c33754c7b5e7cde997a20e137825e85dde6d2.zip
Delegate openshift_manage_node tasks to master host.
Diffstat (limited to 'roles')
-rw-r--r--roles/openshift_manage_node/tasks/main.yml53
1 files changed, 44 insertions, 9 deletions
diff --git a/roles/openshift_manage_node/tasks/main.yml b/roles/openshift_manage_node/tasks/main.yml
index 15c5ab849..88cdd2d89 100644
--- a/roles/openshift_manage_node/tasks/main.yml
+++ b/roles/openshift_manage_node/tasks/main.yml
@@ -3,18 +3,51 @@
command: mktemp -d /tmp/openshift-ansible-XXXXXX
register: mktemp
changed_when: False
+ delegate_to: "{{ openshift_master_host }}"
+ run_once: true
- set_fact:
openshift_manage_node_kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
+ delegate_to: "{{ openshift_master_host }}"
+ run_once: true
- name: Copy the admin client config(s)
command: >
cp {{ openshift.common.config_base }}/master/admin.kubeconfig {{ openshift_manage_node_kubeconfig }}
changed_when: False
+ delegate_to: "{{ openshift_master_host }}"
+ run_once: true
+
+# Necessary because when you're on a node that's also a master the master will be
+# restarted after the node restarts docker and it will take up to 60 seconds for
+# systemd to start the master again
+- name: Wait for master API to become available before proceeding
+ # Using curl here since the uri module requires python-httplib2 and
+ # wait_for port doesn't provide health information.
+ command: >
+ curl --silent --tlsv1.2
+ {% if openshift.common.version_gte_3_2_or_1_2 | bool %}
+ --cacert {{ openshift.common.config_base }}/master/ca-bundle.crt
+ {% else %}
+ --cacert {{ openshift.common.config_base }}/master/ca.crt
+ {% endif %}
+ {{ openshift_node_master_api_url }}/healthz/ready
+ args:
+ # Disables the following warning:
+ # Consider using get_url or uri module rather than running curl
+ warn: no
+ register: api_available_output
+ until: api_available_output.stdout == 'ok'
+ retries: 120
+ delay: 1
+ changed_when: false
+ when: openshift.common.is_containerized | bool
+ delegate_to: "{{ openshift_master_host }}"
+ run_once: true
- name: Wait for Node Registration
command: >
- {{ openshift.common.client_binary }} get node {{ hostvars[item].openshift.node.nodename }}
+ {{ openshift.common.client_binary }} get node {{ openshift.node.nodename }}
--config={{ openshift_manage_node_kubeconfig }}
-n default
register: omd_get_node
@@ -22,27 +55,29 @@
retries: 50
delay: 5
changed_when: false
- with_items: "{{ openshift_nodes }}"
- when: hostvars[item].openshift.node.nodename is defined
+ when: "'nodename' in openshift.node"
+ delegate_to: "{{ openshift_master_host }}"
- name: Set node schedulability
command: >
- {{ openshift.common.client_binary }} adm manage-node {{ hostvars[item].openshift.node.nodename }} --schedulable={{ 'true' if hostvars[item].openshift.node.schedulable | bool else 'false' }}
+ {{ openshift.common.client_binary }} adm manage-node {{ openshift.node.nodename }} --schedulable={{ 'true' if openshift.node.schedulable | bool else 'false' }}
--config={{ openshift_manage_node_kubeconfig }}
-n default
- with_items: "{{ openshift_nodes }}"
- when: hostvars[item].openshift.node.nodename is defined
+ when: "'nodename' in openshift.node"
+ delegate_to: "{{ openshift_master_host }}"
- name: Label nodes
command: >
- {{ openshift.common.client_binary }} label --overwrite node {{ hostvars[item].openshift.node.nodename }} {{ hostvars[item].openshift.node.labels | oo_combine_dict }}
+ {{ openshift.common.client_binary }} label --overwrite node {{ openshift.node.nodename }} {{ openshift.node.labels | oo_combine_dict }}
--config={{ openshift_manage_node_kubeconfig }}
-n default
- with_items: "{{ openshift_nodes }}"
- when: hostvars[item].openshift.node.nodename is defined and 'labels' in hostvars[item].openshift.node and hostvars[item].openshift.node.labels != {}
+ when: "'nodename' in openshift.node and 'labels' in openshift.node and openshift.node.labels != {}"
+ delegate_to: "{{ openshift_master_host }}"
- name: Delete temp directory
file:
name: "{{ mktemp.stdout }}"
state: absent
changed_when: False
+ delegate_to: "{{ openshift_master_host }}"
+ run_once: true