diff options
author | Russell Teague <rteague@redhat.com> | 2017-02-13 10:44:09 -0500 |
---|---|---|
committer | Russell Teague <rteague@redhat.com> | 2017-02-14 09:55:59 -0500 |
commit | 5cf8da61a44bb6a29c9db2bff3b73a03b8a43ebc (patch) | |
tree | f6dd464e7c9082ff38fd47a05c2b55cfdcc97841 /playbooks/common/openshift-cluster/upgrades/initialize_nodes_to_upgrade.yml | |
parent | 7127518224d996e01a89db147434e404ebd35296 (diff) | |
download | openshift-5cf8da61a44bb6a29c9db2bff3b73a03b8a43ebc.tar.gz openshift-5cf8da61a44bb6a29c9db2bff3b73a03b8a43ebc.tar.bz2 openshift-5cf8da61a44bb6a29c9db2bff3b73a03b8a43ebc.tar.xz openshift-5cf8da61a44bb6a29c9db2bff3b73a03b8a43ebc.zip |
Modify playbooks to use oc_obj module
Diffstat (limited to 'playbooks/common/openshift-cluster/upgrades/initialize_nodes_to_upgrade.yml')
-rw-r--r-- | playbooks/common/openshift-cluster/upgrades/initialize_nodes_to_upgrade.yml | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/playbooks/common/openshift-cluster/upgrades/initialize_nodes_to_upgrade.yml b/playbooks/common/openshift-cluster/upgrades/initialize_nodes_to_upgrade.yml index 37c89374c..046535680 100644 --- a/playbooks/common/openshift-cluster/upgrades/initialize_nodes_to_upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/initialize_nodes_to_upgrade.yml @@ -1,20 +1,17 @@ --- - name: Filter list of nodes to be upgraded if necessary hosts: oo_first_master + + roles: + - lib_openshift + tasks: - name: Retrieve list of openshift nodes matching upgrade label - command: > - {{ openshift.common.client_binary }} - get nodes - --config={{ openshift.common.config_base }}/master/admin.kubeconfig - --selector={{ openshift_upgrade_nodes_label }} - -o jsonpath='{.items[*].metadata.name}' - register: matching_nodes - changed_when: false - when: openshift_upgrade_nodes_label is defined - - - set_fact: - nodes_to_upgrade: "{{ matching_nodes.stdout.split(' ') }}" + oc_obj: + state: list + kind: node + selector: "{{ openshift_upgrade_nodes_label }}" + register: nodes_to_upgrade when: openshift_upgrade_nodes_label is defined # We got a list of nodes with the label, now we need to match these with inventory hosts @@ -26,7 +23,9 @@ ansible_ssh_user: "{{ g_ssh_user | default(omit) }}" ansible_become: "{{ g_sudo | default(omit) }}" with_items: " {{ groups['oo_nodes_to_config'] }}" - when: openshift_upgrade_nodes_label is defined and hostvars[item].openshift.common.hostname in nodes_to_upgrade + when: + - openshift_upgrade_nodes_label is defined + - hostvars[item].openshift.common.hostname in nodes_to_upgrade.results.results[0]['items'] | map(attribute='metadata.name') | list changed_when: false # Build up the oo_nodes_to_upgrade group, use the list filtered by label if |