Add validation of OpenStack auth parameters
This commit is contained in:
parent
83c34555b6
commit
cd306f4cf3
@ -29,3 +29,11 @@ openstack_auth_env:
|
|||||||
OS_AUTH_URL: "{{ lookup('env', 'OS_AUTH_URL') }}"
|
OS_AUTH_URL: "{{ lookup('env', 'OS_AUTH_URL') }}"
|
||||||
OS_INTERFACE: "{{ lookup('env', 'OS_INTERFACE') }}"
|
OS_INTERFACE: "{{ lookup('env', 'OS_INTERFACE') }}"
|
||||||
OS_IDENTITY_API_VERSION: "{{ lookup('env', 'OS_IDENTITY_API_VERSION') }}"
|
OS_IDENTITY_API_VERSION: "{{ lookup('env', 'OS_IDENTITY_API_VERSION') }}"
|
||||||
|
|
||||||
|
# List of parameters required in openstack_auth when openstack_auth_type is
|
||||||
|
# password.
|
||||||
|
openstack_auth_password_required_params:
|
||||||
|
- "project_name"
|
||||||
|
- "username"
|
||||||
|
- "password"
|
||||||
|
- "auth_url"
|
||||||
|
@ -1,6 +1,20 @@
|
|||||||
---
|
---
|
||||||
- name: Ensure Ironic Python Agent (IPA) images are downloaded and registered
|
- name: Ensure Ironic Python Agent (IPA) images are downloaded and registered
|
||||||
hosts: controllers[0]
|
hosts: controllers[0]
|
||||||
|
pre_tasks:
|
||||||
|
- name: Validate OpenStack password authentication parameters
|
||||||
|
fail:
|
||||||
|
msg: >
|
||||||
|
Required OpenStack authentication parameter {{ item }} is
|
||||||
|
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
|
||||||
|
in openstack_auth. Have you sourced the environment file?
|
||||||
|
when:
|
||||||
|
- "{{ openstack_auth_type == 'password' }}"
|
||||||
|
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
|
||||||
|
with_items: "{{ openstack_auth_password_required_params }}"
|
||||||
|
tags:
|
||||||
|
- config-validation
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: ipa-images
|
- role: ipa-images
|
||||||
ipa_images_venv: "{{ ansible_env['PWD'] }}/shade-venv"
|
ipa_images_venv: "{{ ansible_env['PWD'] }}/shade-venv"
|
||||||
|
@ -56,6 +56,19 @@
|
|||||||
inspector_rule_var_lldp_switch_port_interface: "{{ inspector_lldp_switch_port_interface }}"
|
inspector_rule_var_lldp_switch_port_interface: "{{ inspector_lldp_switch_port_interface }}"
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
|
- name: Validate OpenStack password authentication parameters
|
||||||
|
fail:
|
||||||
|
msg: >
|
||||||
|
Required OpenStack authentication parameter {{ item }} is
|
||||||
|
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
|
||||||
|
in openstack_auth. Have you sourced the environment file?
|
||||||
|
when:
|
||||||
|
- "{{ openstack_auth_type == 'password' }}"
|
||||||
|
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
|
||||||
|
with_items: "{{ openstack_auth_password_required_params }}"
|
||||||
|
tags:
|
||||||
|
- config-validation
|
||||||
|
|
||||||
# We build up the rules using a 2-step process. First we build a list of
|
# We build up the rules using a 2-step process. First we build a list of
|
||||||
# relevant switch hosts and their interface configuration (in list form).
|
# relevant switch hosts and their interface configuration (in list form).
|
||||||
# This allows us to use with_subelements in the next task to iterate over
|
# This allows us to use with_subelements in the next task to iterate over
|
||||||
|
@ -4,6 +4,20 @@
|
|||||||
hosts: controllers[0]
|
hosts: controllers[0]
|
||||||
vars:
|
vars:
|
||||||
venv: "{{ ansible_env.PWD }}/shade-venv"
|
venv: "{{ ansible_env.PWD }}/shade-venv"
|
||||||
|
pre_tasks:
|
||||||
|
- name: Validate OpenStack password authentication parameters
|
||||||
|
fail:
|
||||||
|
msg: >
|
||||||
|
Required OpenStack authentication parameter {{ item }} is
|
||||||
|
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
|
||||||
|
in openstack_auth. Have you sourced the environment file?
|
||||||
|
when:
|
||||||
|
- "{{ openstack_auth_type == 'password' }}"
|
||||||
|
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
|
||||||
|
with_items: "{{ openstack_auth_password_required_params }}"
|
||||||
|
tags:
|
||||||
|
- config-validation
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: openstackclient
|
- role: openstackclient
|
||||||
openstackclient_venv: "{{ venv }}"
|
openstackclient_venv: "{{ venv }}"
|
||||||
|
@ -4,6 +4,20 @@
|
|||||||
hosts: controllers[0]
|
hosts: controllers[0]
|
||||||
vars:
|
vars:
|
||||||
venv: "{{ ansible_env.PWD }}/shade-venv"
|
venv: "{{ ansible_env.PWD }}/shade-venv"
|
||||||
|
pre_tasks:
|
||||||
|
- name: Validate OpenStack password authentication parameters
|
||||||
|
fail:
|
||||||
|
msg: >
|
||||||
|
Required OpenStack authentication parameter {{ item }} is
|
||||||
|
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
|
||||||
|
in openstack_auth. Have you sourced the environment file?
|
||||||
|
when:
|
||||||
|
- "{{ openstack_auth_type == 'password' }}"
|
||||||
|
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
|
||||||
|
with_items: "{{ openstack_auth_password_required_params }}"
|
||||||
|
tags:
|
||||||
|
- config-validation
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: neutron-net
|
- role: neutron-net
|
||||||
neutron_net_venv: "{{ venv }}"
|
neutron_net_venv: "{{ venv }}"
|
||||||
|
@ -20,6 +20,19 @@
|
|||||||
test_ssh_key_type: rsa
|
test_ssh_key_type: rsa
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
|
- name: Validate OpenStack password authentication parameters
|
||||||
|
fail:
|
||||||
|
msg: >
|
||||||
|
Required OpenStack authentication parameter {{ item }} is
|
||||||
|
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
|
||||||
|
in openstack_auth. Have you sourced the environment file?
|
||||||
|
when:
|
||||||
|
- "{{ openstack_auth_type == 'password' }}"
|
||||||
|
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
|
||||||
|
with_items: "{{ openstack_auth_password_required_params }}"
|
||||||
|
tags:
|
||||||
|
- config-validation
|
||||||
|
|
||||||
- name: Check whether an SSH key exists on the controller
|
- name: Check whether an SSH key exists on the controller
|
||||||
stat:
|
stat:
|
||||||
path: "{{ test_ssh_private_key_path }}"
|
path: "{{ test_ssh_private_key_path }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user