Allow for passing boot-time vars/args to OC nodes

openshift-ansible allows for passing boot time arguments to the
openshift nodes as well as other variables through the inventory. By
adding the OpenShift(Master|Worker)NodeVars variable, we'll allow for
these variables to be set and customized per deployment.

Co-Authored-By: Martin André <m.andre@redhat.com>
Change-Id: Ifc8d26fab314a89bf1855fd9035c2ad9be23c28a
This commit is contained in:
Flavio Percoco 2018-03-14 17:24:40 +01:00 committed by Martin André
parent e4af98144c
commit de39f8a3eb

View File

@ -32,7 +32,6 @@ parameters:
description: Mapping of service endpoint -> protocol. Typically set description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry. via parameter_defaults in the resource registry.
type: json type: json
OpenShiftGlobalVariables: OpenShiftGlobalVariables:
default: {} default: {}
description: Global Ansible variables for OpenShift-Ansible installer. description: Global Ansible variables for OpenShift-Ansible installer.
@ -41,6 +40,14 @@ parameters:
default: '/usr/share/ansible/openshift-ansible/playbooks/byo/config.yml' default: '/usr/share/ansible/openshift-ansible/playbooks/byo/config.yml'
description: Path to OpenShift-Ansible playbook. description: Path to OpenShift-Ansible playbook.
type: string type: string
OpenShiftMasterNodeVars:
default: {}
description: OpenShift node vars specific for the master nodes
type: json
OpenShiftWorkerNodeVars:
default: {}
description: OpenShift node vars specific for the worker nodes
type: json
outputs: outputs:
role_data: role_data:
@ -69,6 +76,13 @@ outputs:
state: directory state: directory
with_items: with_items:
- "{{playbook_dir}}/openshift" - "{{playbook_dir}}/openshift"
- name: set openshift global vars fact
set_fact:
openshift_global_vars: {get_param: OpenShiftGlobalVariables}
openshift_master_node_vars: {get_param: OpenShiftMasterNodeVars}
openshift_worker_node_vars: {get_param: OpenShiftWorkerNodeVars}
- name: generate openshift inventory - name: generate openshift inventory
copy: copy:
dest: "{{playbook_dir}}/openshift/inventory.yml" dest: "{{playbook_dir}}/openshift/inventory.yml"
@ -85,6 +99,10 @@ outputs:
openshift_public_ip: {{hostvars.raw_get(host)['ctlplane_ip']}} openshift_public_ip: {{hostvars.raw_get(host)['ctlplane_ip']}}
openshift_hostname: {{hostvars.raw_get(host)['ctlplane_ip']}} openshift_hostname: {{hostvars.raw_get(host)['ctlplane_ip']}}
openshift_public_hostname: {{hostvars.raw_get(host)['ctlplane_ip']}} openshift_public_hostname: {{hostvars.raw_get(host)['ctlplane_ip']}}
{% if openshift_master_node_vars -%}
{{openshift_master_node_vars | to_nice_yaml() | indent(6)}}
{%- endif %}
{% endfor %} {% endfor %}
nodes: nodes:
@ -103,6 +121,10 @@ outputs:
openshift_node_labels: openshift_node_labels:
region: 'infra' region: 'infra'
zone: 'default' zone: 'default'
{% if openshift_worker_node_vars -%}
{{openshift_worker_node_vars | to_nice_yaml() | indent(6)}}
{%- endif %}
{% endfor %} {% endfor %}
etcd: etcd:
@ -123,10 +145,6 @@ outputs:
openshift_use_dnsmasq: true openshift_use_dnsmasq: true
openshift_use_external_openvswitch: true openshift_use_external_openvswitch: true
- name: set openshift global vars fact
set_fact:
openshift_global_vars: {get_param: OpenShiftGlobalVariables}
- name: generate openshift global vars - name: generate openshift global vars
copy: copy:
dest: "{{playbook_dir}}/openshift/global_vars.yml" dest: "{{playbook_dir}}/openshift/global_vars.yml"