diff options
author | Andrew Butcher <abutcher@redhat.com> | 2016-09-07 14:11:10 -0400 |
---|---|---|
committer | Andrew Butcher <abutcher@redhat.com> | 2016-09-07 14:25:25 -0400 |
commit | 4158ea7fbf9b31a803413a51a6a01fc7f2902e9c (patch) | |
tree | 6cb6d1000e4a35aa47527d799eda658e8b413e98 /roles | |
parent | 485f45b7d62b358ba477b76b4146f3338ea6a5c4 (diff) | |
download | openshift-4158ea7fbf9b31a803413a51a6a01fc7f2902e9c.tar.gz openshift-4158ea7fbf9b31a803413a51a6a01fc7f2902e9c.tar.bz2 openshift-4158ea7fbf9b31a803413a51a6a01fc7f2902e9c.tar.xz openshift-4158ea7fbf9b31a803413a51a6a01fc7f2902e9c.zip |
Copy admin kubeconfig in openshift_manage_node role.
Diffstat (limited to 'roles')
-rw-r--r-- | roles/openshift_manage_node/tasks/main.yml | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/roles/openshift_manage_node/tasks/main.yml b/roles/openshift_manage_node/tasks/main.yml index 5abac32cd..115c44067 100644 --- a/roles/openshift_manage_node/tasks/main.yml +++ b/roles/openshift_manage_node/tasks/main.yml @@ -1,6 +1,22 @@ +--- +- name: Create temp directory for kubeconfig + command: mktemp -d /tmp/openshift-ansible-XXXXXX + register: mktemp + changed_when: False + +- set_fact: + openshift_manage_node_kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig" + +- name: Copy the admin client config(s) + command: > + cp {{ openshift.common.config_base }}/master/admin.kubeconfig {{ openshift_manage_node_kubeconfig }} + changed_when: False + - name: Wait for Node Registration command: > - {{ openshift.common.client_binary }} get node {{ item | lower }} + {{ openshift.common.client_binary }} get node {{ item | lower }} + --config={{ openshift_manage_node_kubeconfig }} + -n default register: omd_get_node until: omd_get_node.rc == 0 retries: 50 @@ -11,6 +27,8 @@ - name: Set node schedulability command: > {{ openshift.common.admin_binary }} manage-node {{ item.openshift.common.hostname | lower }} --schedulable={{ 'true' if item.openshift.node.schedulable | bool else 'false' }} + --config={{ openshift_manage_node_kubeconfig }} + -n default with_items: - "{{ openshift_node_vars }}" when: item.openshift.common.hostname is defined @@ -18,6 +36,14 @@ - name: Label nodes command: > {{ openshift.common.client_binary }} label --overwrite node {{ item.openshift.common.hostname | lower }} {{ item.openshift.node.labels | oo_combine_dict }} + --config={{ openshift_manage_node_kubeconfig }} + -n default with_items: - "{{ openshift_node_vars }}" when: item.openshift.common.hostname is defined and 'labels' in item.openshift.node and item.openshift.node.labels != {} + +- name: Delete temp directory + file: + name: "{{ mktemp.stdout }}" + state: absent + changed_when: False |