Skip to content

Instantly share code, notes, and snippets.

@vrutkovs
Created March 13, 2018 21:16
Show Gist options
  • Save vrutkovs/20bd2b04903e18fcf9b4ef11830000e8 to your computer and use it in GitHub Desktop.
Save vrutkovs/20bd2b04903e18fcf9b4ef11830000e8 to your computer and use it in GitHub Desktop.
/tmp/ansible_test  ansible-playbook-3 playbook.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] **********************************************************************************************************************************************
TASK [set_fact] ***********************************************************************************************************************************************
ok: [localhost]
TASK [set_fact] ***********************************************************************************************************************************************
ok: [localhost]
TASK [debug] **************************************************************************************************************************************************
ok: [localhost] => {
"openshift_node_group_labels": [
[
"node-role.kubernetes.io/master='true'",
"node-role.kubernetes.io/infra='true'"
]
]
}
TASK [set_fact] ***********************************************************************************************************************************************
ok: [localhost]
TASK [debug] **************************************************************************************************************************************************
ok: [localhost] => {
"lbls": [
"node-role.kubernetes.io/master='true'",
"node-role.kubernetes.io/infra='true'"
]
}
PLAY RECAP ****************************************************************************************************************************************************
localhost : ok=5 changed=0 unreachable=0 failed=0
---
- hosts: localhost
gather_facts: false
tasks:
- set_fact:
openshift_node_groups:
- name: "node-config-master"
labels:
- node-role.kubernetes.io/master='true'
- node-role.kubernetes.io/infra='true'
- name: "node-config-node"
labels:
- node-role.kubernetes.io/compute='true'
- set_fact:
openshift_node_group_labels: "{{ openshift_node_groups | selectattr('name', 'match', 'node-config-master') | map(attribute='labels') | list }}"
- debug: var=openshift_node_group_labels
- set_fact:
lbls: "{{ openshift_node_group_labels|join(',') }}"
- debug: var=lbls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment