Move storage_address discovery into a single task
The storage address variable needs to be defined before running other common tasks. The `storage_address` variable, when defined in a cinder storage backend, causes an exception at runtime as the host_var will be undefined. This patch moves the `storage_address` discovery set of tasks into its one task and allows the option to be known before running anything else. Closes-Bug: #1632393 Change-Id: I547c72943396af92df2a298470e3f89b4d1e3a2d Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
2ab8a81cd3
commit
f5d8578646
|
@ -19,6 +19,30 @@
|
|||
max_fail_percentage: 20
|
||||
user: root
|
||||
pre_tasks:
|
||||
- name: Set the cinder storage address
|
||||
set_fact:
|
||||
# NOTE(cloudnull):
|
||||
# Collect the storage address interface data from the host vars of the target node then
|
||||
# Check if the host is running in a container. If not, pull the bridge data from the
|
||||
# storage network. If a storage_bridge is defined pull the IP address from the physical
|
||||
# network device. If no physical bridge is defined collect the storage address from the
|
||||
# "storage_network_data" variable. If nothing is defined use the "ansible_host" address.
|
||||
storage_address: >-
|
||||
{%- set storage_network_data = hostvars[inventory_hostname]['container_networks']['storage_address'] | default({}) -%}
|
||||
{%- if is_metal is defined and is_metal | bool -%}
|
||||
{%- set storage_bridge = storage_network_data['bridge'] | default('no_bridge_defined') | replace('-', '_') -%}
|
||||
{%- else -%}
|
||||
{%- set storage_bridge = 'no_bridge_defined' -%}
|
||||
{%- endif -%}
|
||||
{%- if storage_bridge != 'no_bridge_defined' -%}
|
||||
{{ hostvars[inventory_hostname]['ansible_' + storage_bridge]['ipv4']['address'] }}
|
||||
{%- elif storage_network_data['address'] is defined -%}
|
||||
{{ storage_network_data['address'] }}
|
||||
{%- else -%}
|
||||
{{ ansible_host }}
|
||||
{%- endif -%}
|
||||
tags:
|
||||
- always
|
||||
- include: common-tasks/os-lxc-container-setup.yml
|
||||
static: no
|
||||
vars:
|
||||
|
@ -92,46 +116,6 @@
|
|||
command: udevadm trigger
|
||||
delegate_to: "{{ physical_host }}"
|
||||
when: cinder_backend_lvm_inuse | bool
|
||||
- name: Set cinder storage bridge (is_metal)
|
||||
set_fact:
|
||||
storage_bridge: "{{ 'ansible_' + hostvars[inventory_hostname]['container_networks']['storage_address']['bridge'] | replace('-', '_') }}"
|
||||
when:
|
||||
- hostvars[inventory_hostname]['container_networks']['storage_address']['bridge'] is defined
|
||||
- is_metal | bool
|
||||
tags:
|
||||
- always
|
||||
- name: Set cinder storage address (is_metal)
|
||||
set_fact:
|
||||
storage_address: "{{ hostvars[inventory_hostname][storage_bridge]['ipv4']['address'] }}"
|
||||
when:
|
||||
- hostvars[inventory_hostname]['container_networks']['storage_address']['bridge'] is defined
|
||||
- is_metal | bool
|
||||
tags:
|
||||
- always
|
||||
- name: Set cinder storage bridge (is_metal no storage network)
|
||||
set_fact:
|
||||
storage_address: "{{ ansible_host }}"
|
||||
when:
|
||||
- hostvars[inventory_hostname]['container_networks']['storage_address']['bridge'] is undefined
|
||||
- is_metal | bool
|
||||
tags:
|
||||
- always
|
||||
- name: Set cinder storage address (container)
|
||||
set_fact:
|
||||
storage_address: "{{ hostvars[inventory_hostname]['container_networks']['storage_address']['address'] }}"
|
||||
when:
|
||||
- hostvars[inventory_hostname]['container_networks']['storage_address']['address'] is defined
|
||||
- not is_metal | bool
|
||||
tags:
|
||||
- always
|
||||
- name: Set cinder storage address (container no storage network)
|
||||
set_fact:
|
||||
storage_address: "{{ ansible_host }}"
|
||||
when:
|
||||
- hostvars[inventory_hostname]['container_networks']['storage_address']['address'] is undefined
|
||||
- not is_metal | bool
|
||||
tags:
|
||||
- always
|
||||
roles:
|
||||
- role: "os_cinder"
|
||||
cinder_venv_tag: "{{ openstack_release }}"
|
||||
|
|
Loading…
Reference in New Issue