Consume NodeDataLookup in ceph-ansible
Makes it possible to provide per-node variables to ceph-ansible
using the NodeDataLookup parameter, the same consumed by the
$roleExtraConfigPre resource for puppet hieradata.
Change-Id: Ia23825aea938f6f9bcf536e35cad562a1b96c93b
Closes-Bug: #1736707
Co-Authored-By: fulton@redhat.com
(cherry picked from commit eda02c05d7
)
This commit is contained in:
parent
05357aa9e6
commit
9bb5fcc5bd
|
@ -20,6 +20,7 @@ workflows:
|
||||||
ANSIBLE_HOST_KEY_CHECKING: 'False'
|
ANSIBLE_HOST_KEY_CHECKING: 'False'
|
||||||
- ceph_ansible_extra_vars: {}
|
- ceph_ansible_extra_vars: {}
|
||||||
- ceph_ansible_playbook: /usr/share/ceph-ansible/site-docker.yml.sample
|
- ceph_ansible_playbook: /usr/share/ceph-ansible/site-docker.yml.sample
|
||||||
|
- node_data_lookup: '{}'
|
||||||
tags:
|
tags:
|
||||||
- tripleo-common-managed
|
- tripleo-common-managed
|
||||||
tasks:
|
tasks:
|
||||||
|
@ -46,15 +47,54 @@ workflows:
|
||||||
mds_ips: <% env().get('service_ips', {}).get('ceph_mds_ctlplane_node_ips', []) %>
|
mds_ips: <% env().get('service_ips', {}).get('ceph_mds_ctlplane_node_ips', []) %>
|
||||||
rgw_ips: <% env().get('service_ips', {}).get('ceph_rgw_ctlplane_node_ips', []) %>
|
rgw_ips: <% env().get('service_ips', {}).get('ceph_rgw_ctlplane_node_ips', []) %>
|
||||||
client_ips: <% env().get('service_ips', {}).get('ceph_client_ctlplane_node_ips', []) %>
|
client_ips: <% env().get('service_ips', {}).get('ceph_client_ctlplane_node_ips', []) %>
|
||||||
|
on-success: merge_ip_lists
|
||||||
|
merge_ip_lists:
|
||||||
|
publish:
|
||||||
|
ips_list: <% ($.mon_ips + $.osd_ips + $.mds_ips + $.rgw_ips + $.client_ips).toSet() %>
|
||||||
on-success: set_fork_count
|
on-success: set_fork_count
|
||||||
set_fork_count:
|
set_fork_count:
|
||||||
publish: # unique list of all IPs: make each list a set, take unions and count
|
publish:
|
||||||
fork_count: <% min($.mon_ips.toSet().union($.osd_ips.toSet()).union($.mds_ips.toSet()).union($.rgw_ips.toSet()).union($.client_ips.toSet()).count(), 100) %> # don't use >100 forks
|
fork_count: <% min($.ips_list.count(), 100) %> # don't use >100 forks
|
||||||
on-success: make_fetch_directory
|
on-success: make_fetch_directory
|
||||||
make_fetch_directory:
|
make_fetch_directory:
|
||||||
action: tripleo.files.make_temp_dir
|
action: tripleo.files.make_temp_dir
|
||||||
publish:
|
publish:
|
||||||
fetch_directory: <% task(make_fetch_directory).result.path %>
|
fetch_directory: <% task(make_fetch_directory).result.path %>
|
||||||
|
on-success: collect_nodes_uuid
|
||||||
|
collect_nodes_uuid:
|
||||||
|
action: tripleo.ansible-playbook
|
||||||
|
input:
|
||||||
|
inventory:
|
||||||
|
overcloud:
|
||||||
|
hosts: <% $.ips_list.toDict($, {}) %>
|
||||||
|
remote_user: tripleo-admin
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
verbosity: 0
|
||||||
|
ssh_private_key: <% $.private_key %>
|
||||||
|
extra_env_variables:
|
||||||
|
ANSIBLE_HOST_KEY_CHECKING: 'False'
|
||||||
|
ANSIBLE_STDOUT_CALLBACK: 'json'
|
||||||
|
playbook:
|
||||||
|
- hosts: overcloud
|
||||||
|
gather_facts: no
|
||||||
|
tasks:
|
||||||
|
- name: collect machine id
|
||||||
|
command: dmidecode -s system-uuid
|
||||||
|
publish:
|
||||||
|
ansible_output: <% json_parse(task().result.stderr) %>
|
||||||
|
on-success: set_ip_uuids
|
||||||
|
set_ip_uuids:
|
||||||
|
publish:
|
||||||
|
ip_uuids: <% let(root => $.ansible_output.get('plays')[0].get('tasks')[0].get('hosts')) -> $.ips_list.toDict($, $root.get($).get('stdout')) %>
|
||||||
|
on-success: parse_node_data_lookup
|
||||||
|
parse_node_data_lookup:
|
||||||
|
publish:
|
||||||
|
json_node_data_lookup: <% json_parse($.node_data_lookup) %>
|
||||||
|
on-success: map_node_data_lookup
|
||||||
|
map_node_data_lookup:
|
||||||
|
publish:
|
||||||
|
ips_data: <% let(uuids => $.ip_uuids, root => $) -> $.ips_list.toDict($, $root.json_node_data_lookup.get($uuids.get($, "NO-UUID-FOUND"), {})) %>
|
||||||
on-success: set_role_vars
|
on-success: set_role_vars
|
||||||
set_role_vars:
|
set_role_vars:
|
||||||
publish:
|
publish:
|
||||||
|
@ -75,15 +115,17 @@ workflows:
|
||||||
input:
|
input:
|
||||||
inventory:
|
inventory:
|
||||||
mons:
|
mons:
|
||||||
hosts: <% $.mon_ips.toDict($, {}) %>
|
hosts: <% let(root => $) -> $.mon_ips.toDict($, $root.ips_data.get($, {})) %>
|
||||||
osds:
|
osds:
|
||||||
hosts: <% $.osd_ips.toDict($, {}) %>
|
hosts: <% let(root => $) -> $.osd_ips.toDict($, $root.ips_data.get($, {})) %>
|
||||||
mdss:
|
mdss:
|
||||||
hosts: <% $.mds_ips.toDict($, {}) %>
|
hosts: <% let(root => $) -> $.mds_ips.toDict($, $root.ips_data.get($, {})) %>
|
||||||
rgws:
|
rgws:
|
||||||
hosts: <% $.rgw_ips.toDict($, {}) %>
|
hosts: <% let(root => $) -> $.rgw_ips.toDict($, $root.ips_data.get($, {})) %>
|
||||||
clients:
|
clients:
|
||||||
hosts: <% $.client_ips.toDict($, {}) %>
|
hosts: <% let(root => $) -> $.client_ips.toDict($, $root.ips_data.get($, {})) %>
|
||||||
|
all:
|
||||||
|
vars: <% $.extra_vars %>
|
||||||
playbook: <% $.ceph_ansible_playbook %>
|
playbook: <% $.ceph_ansible_playbook %>
|
||||||
remote_user: tripleo-admin
|
remote_user: tripleo-admin
|
||||||
become: true
|
become: true
|
||||||
|
@ -93,7 +135,6 @@ workflows:
|
||||||
ssh_private_key: <% $.private_key %>
|
ssh_private_key: <% $.private_key %>
|
||||||
skip_tags: <% $.ansible_skip_tags %>
|
skip_tags: <% $.ansible_skip_tags %>
|
||||||
extra_env_variables: <% $.ansible_extra_env_variables %>
|
extra_env_variables: <% $.ansible_extra_env_variables %>
|
||||||
extra_vars: <% $.extra_vars %>
|
|
||||||
publish:
|
publish:
|
||||||
output: <% task(ceph_install).result %>
|
output: <% task(ceph_install).result %>
|
||||||
on-complete: purge_fetch_directory
|
on-complete: purge_fetch_directory
|
||||||
|
|
Loading…
Reference in New Issue