-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathservice_discovery.yml
39 lines (36 loc) · 1.33 KB
/
service_discovery.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- name: Get service nodes from Undercloud
shell: |
source ~/{{ install.overcloud.stack }}rc
{{ service_map[service].command }}
register: uc_service_info
tags: skip_ansible_lint
when: service_map[service].command_execution == "undercloud"
- name: Discover service at Overcloud Nodes
ignore_errors: yes
shell: "{{ service_map[service].command }}"
register: oc_service_info
delegate_to: "{{ item }}"
with_items: "{{ groups.overcloud_nodes|default([])|difference(groups.unused|default([])) }}"
tags: skip_ansible_lint
when: service_map[service].command_execution == "overcloud_nodes"
- name: Add hosts from Undercloud discovery to inventory
add_host:
name: "{{ host }}"
groups: "{{ hostvars[host].group_names + [ service_map[service].group ] }}"
with_items: "{{ uc_service_info.stdout.split('\n') }}"
vars:
host: "{{ item }}"
tags: skip_ansible_lint
when: service_map[service].command_execution == "undercloud"
- name: Add hosts from Overcloud discovery to inventory
add_host:
name: "{{ host }}"
groups: "{{ hostvars[host].group_names + [ service_map[service].group ] }}"
with_items: "{{ oc_service_info.results }}"
vars:
host: "{{ item.item }}"
tags: skip_ansible_lint
when:
- service_map[service].command_execution == "overcloud_nodes"
- item.rc == 0