Merge "Fix ansible-lint nits"

This commit is contained in:
Zuul 2018-12-20 11:20:33 +00:00 committed by Gerrit Code Review
commit 9efd49998f
9 changed files with 82 additions and 62 deletions

View File

@ -3,7 +3,7 @@
include_vars: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version}}.yml"
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
skip: true
@ -12,6 +12,9 @@
- name: Ensure general system requirements are installed
package:
name: "{{ system_requirements }}"
register: result
until: result is success
retries: 3
become: true
# Don't uninstall requirements during teardown since they may already have
# been present.
@ -35,6 +38,9 @@
- name: Ensure Open vSwitch package is installed
package:
name: "{{ tenks_openvswitch_pkg_name }}"
register: result
until: result is success
retries: 3
become: true
- name: Ensure Open vSwitch is started and enabled

View File

@ -4,7 +4,7 @@
include_vars: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version}}.yml"
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
skip: true

View File

@ -11,7 +11,7 @@
resource:
amount: "{{ spec.count | int }}" # this gets converted back to a string
resource_class: "{{ 'CUSTOM_' ~ spec.ironic_config.resource_class | upper | replace('-', '_') }}"
traits: "{{ spec.ironic_config.traits | default([])}}"
traits: "{{ spec.ironic_config.traits | default([]) }}"
set_fact:
tenks_expected_resources: >-
{{ tenks_expected_resources + [resource] }}

View File

@ -22,6 +22,9 @@
extra_args: >-
-c {{ ironic_python_upper_constraints_url }}
virtualenv: "{{ ironic_virtualenv_path }}"
register: result
until: result is success
retries: 3
# This command will return the UUIDs, regardless of whether
# ironic_deploy_kernel and ironic_deploy_ramdisk are image UUIDs or names.
@ -36,7 +39,7 @@
# for enrolment to continue.
when:
- item is not none
- item != ""
- item | length > 0
register: deploy_image_ids
changed_when: false

View File

@ -11,7 +11,7 @@
- name: Fail if port is not found
fail:
msg: Ironic port with MAC address {{ mac }} not found
when: uuid.stdout == ""
when: not uuid.stdout
- name: Get physical network name
set_fact:

View File

@ -1,55 +1,58 @@
---
- name: Ensure Python requirements are installed
pip:
requirements: "{{ '/'.join([role_path, 'files', 'requirements.txt']) }}"
extra_args: >-
-c {{ flavors_python_upper_constraints_url }}
virtualenv: "{{ flavors_virtualenv_path }}"
- name: Ensure Python requirements are installed
pip:
requirements: "{{ '/'.join([role_path, 'files', 'requirements.txt']) }}"
extra_args: >-
-c {{ flavors_python_upper_constraints_url }}
virtualenv: "{{ flavors_virtualenv_path }}"
register: result
until: result is success
retries: 3
- name: Configure Nova flavors
os_nova_flavor:
auth_type: password
name: "{{ item.name | default(item.resource_class) }}"
# FIXME(w-miller): don't necessarily assume the first disk?
disk: "{{ node_types[item.node_type].volumes.0.capacity | default('0')
| size_string_to_gb }}"
ram: "{{ node_types[item.node_type].memory_mb }}"
vcpus: "{{ node_types[item.node_type].vcpus }}"
# NOTE(w-miller): I'm not quite sure whether this is janky or beautiful.
#
# * Set hardware specs to zero here for scheduling purposes.
# * Add the resource class name.
# * Add required and forbidden traits.
# * Add any custom specs from the user.
extra_specs: >-
{{ hw_specs
| combine(resource_class)
| combine(required_traits)
| combine(forbidden_traits)
| combine(item.custom_specs | default({}))
}}
state: "{{ flavors_state }}"
vars:
hw_specs:
"resources:DISK_GB": 0
"resources:MEMORY_MB": 0
"resources:VCPU": 0
resource_class: >-
{{ {
"resources:CUSTOM_" ~ (
item.resource_class | upper
| regex_replace('[^A-Z0-9]', '_')): 1
} }}
required_traits: >-
{{ dict(item.required_traits
| default([])
| map('regex_replace', '(.*)', 'trait:\1')
| zip_longest([], fillvalue='required')) }}
forbidden_traits: >-
{{ dict(item.forbidden_traits
| default([])
| map('regex_replace', '(.*)', 'trait:\1')
| zip_longest([], fillvalue='forbidden')) }}
ansible_python_interpreter: >-
{{ '/'.join([flavors_virtualenv_path, 'bin', 'python']) }}
loop: "{{ flavors }}"
- name: Configure Nova flavors
os_nova_flavor:
auth_type: password
name: "{{ item.name | default(item.resource_class) }}"
# FIXME(w-miller): don't necessarily assume the first disk?
disk: "{{ node_types[item.node_type].volumes.0.capacity | default('0')
| size_string_to_gb }}"
ram: "{{ node_types[item.node_type].memory_mb }}"
vcpus: "{{ node_types[item.node_type].vcpus }}"
# NOTE(w-miller): I'm not quite sure whether this is janky or beautiful.
#
# * Set hardware specs to zero here for scheduling purposes.
# * Add the resource class name.
# * Add required and forbidden traits.
# * Add any custom specs from the user.
extra_specs: >-
{{ hw_specs
| combine(resource_class)
| combine(required_traits)
| combine(forbidden_traits)
| combine(item.custom_specs | default({}))
}}
state: "{{ flavors_state }}"
vars:
hw_specs:
"resources:DISK_GB": 0
"resources:MEMORY_MB": 0
"resources:VCPU": 0
resource_class: >-
{{ {
"resources:CUSTOM_" ~ (
item.resource_class | upper
| regex_replace('[^A-Z0-9]', '_')): 1
} }}
required_traits: >-
{{ dict(item.required_traits
| default([])
| map('regex_replace', '(.*)', 'trait:\1')
| zip_longest([], fillvalue='required')) }}
forbidden_traits: >-
{{ dict(item.forbidden_traits
| default([])
| map('regex_replace', '(.*)', 'trait:\1')
| zip_longest([], fillvalue='forbidden')) }}
ansible_python_interpreter: >-
{{ '/'.join([flavors_virtualenv_path, 'bin', 'python']) }}
loop: "{{ flavors }}"

View File

@ -3,7 +3,7 @@
include_vars: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version}}.yml"
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
skip: true
@ -11,9 +11,11 @@
- name: Ensure package dependencies are installed
package:
name: "{{ item }}"
name: "{{ vbmcd_packages }}"
state: installed
loop: "{{ vbmcd_packages }}"
register: result
until: result is success
retries: 3
become: true
# This is useful to get a uniquely generated temporary path.
@ -32,6 +34,9 @@
extra_args: >-
-c {{ vbmcd_python_upper_constraints_url }}
virtualenv: "{{ vbmcd_virtualenv_path }}"
register: result
until: result is success
retries: 3
- name: Ensure Virtual BMC systemd service is configured
template:

View File

@ -45,7 +45,7 @@
--username '{{ vbmc_ipmi_username }}'
--password '{{ vbmc_ipmi_password }}'
--address {{ vbmc_ipmi_address }}
{% if vbmc_libvirt_uri %} --libvirt-uri '{{vbmc_libvirt_uri}}'{% endif %}
{% if vbmc_libvirt_uri %} --libvirt-uri '{{ vbmc_libvirt_uri }}'{% endif %}
when: vbmc_state == 'present'
become: true
tags:

View File

@ -29,6 +29,9 @@
-c {{ wait_for_resources_python_upper_constraints_url }}
{%- endif -%}
virtualenv: "{{ wait_for_resources_venv }}"
register: result
until: result is success
retries: 3
- name: Call wait_for_resources module
wait_for_resources: