Skip to content

Instantly share code, notes, and snippets.

@dgoodwin
Created September 15, 2016 19:45
Show Gist options
  • Save dgoodwin/47138fcf6f4bf2def57fcbafea37241d to your computer and use it in GitHub Desktop.
Save dgoodwin/47138fcf6f4bf2def57fcbafea37241d to your computer and use it in GitHub Desktop.
- hosts: oo_first_master
tasks:
- debug: var=openshift.common.client_binary
- debug: var=openshift_upgrade_nodes_label
- 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(' ') }}"
- debug: var=nodes_to_upgrade
- debug: var=matching_nodes.stdout.split(' ')
- debug: var=groups['oo_nodes_to_config']
- name: Evaluate oo_nodes_to_config
add_host:
name: "{{ item }}"
groups: oo_nodes_to_upgrade
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_become: "{{ g_sudo | default(omit) }}"
when: hostvars[item].openshift.common.hostname in nodes_to_upgrade
#with_items: "{{ matching_nodes.stdout.split(' ') }}"
with_items: " {{ groups['oo_nodes_to_config'] }}"
changed_when: false
- debug: var=groups['oo_nodes_to_upgrade']
- fail:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment