Generate post-deployment openshift-ansible inventory

This allows to run custom openshift-ansible playbooks with an inventory
that reflects the deployment status.

Related-Bug: #1812962
Change-Id: I94b6ae04a3e31fe0b7951df2446cc91b5842cd77
This commit is contained in:
Martin André 2019-01-22 10:05:30 +01:00
parent 1febc8b7b3
commit ff36d44af5
2 changed files with 39 additions and 1 deletions

View File

@ -521,7 +521,7 @@ outputs:
{% endif %} {% endif %}
- name: generate openshift validation playbook - name: generate openshift playbook for etcd scaleup
copy: copy:
dest: "{{playbook_dir}}/openshift/playbook.yml" dest: "{{playbook_dir}}/openshift/playbook.yml"
content: | content: |
@ -536,6 +536,23 @@ outputs:
{{openshift_command}} 2>&1 | tee {{playbook_dir}}/openshift/playbook-etcd.log {{openshift_command}} 2>&1 | tee {{playbook_dir}}/openshift/playbook-etcd.log
exit ${PIPESTATUS[0]} exit ${PIPESTATUS[0]}
- name: generate post-deployment inventory for master nodes
copy:
dest: "{{playbook_dir}}/openshift/inventory/{{tripleo_role_name}}_openshift_master.yml"
content: |
{% if (role_nodes[tripleo_role_name] + new_role_nodes[tripleo_role_name]) | count > 0%}
all:
children:
masters:
hosts:
{% for host in (role_nodes[tripleo_role_name] + new_role_nodes[tripleo_role_name]) -%}
{{host.hostname}}:
{% endfor %}
vars:
{{openshift_master_node_vars | to_nice_yaml() | indent(6)}}
{% endif %}
- name: generate openshift validation playbook - name: generate openshift validation playbook
copy: copy:
dest: "{{playbook_dir}}/openshift/playbook.yml" dest: "{{playbook_dir}}/openshift/playbook.yml"

View File

@ -172,3 +172,24 @@ outputs:
{% endif %} {% endif %}
{% endif %} {% endif %}
- name: openshift_node step 4
when: step == '4'
tags: openshift
block:
- name: set role facts for generating inventory
set_fact:
tripleo_role_name: {get_param: RoleName}
- name: generate post-deployment inventory for {{tripleo_role_name}} role groups
copy:
dest: "{{playbook_dir}}/openshift/inventory/{{tripleo_role_name}}_groups.yml"
content: |
{% if (role_nodes[tripleo_role_name] + new_role_nodes[tripleo_role_name]) | count > 0%}
all:
children:
nodes:
hosts:
{% for host in (role_nodes[tripleo_role_name] + new_role_nodes[tripleo_role_name]) -%}
{{host.hostname}}:
{% endfor %}
{% endif %}