Merge "Fix key-order[task] linter warnings"

This commit is contained in:
Zuul
2023-07-10 11:43:10 +00:00
committed by Gerrit Code Review
13 changed files with 202 additions and 211 deletions

View File

@@ -4,7 +4,6 @@ skip_list:
- fqcn[action-core] # Use FQCN for builtin actions
- ignore-errors # Use failed_when and specify error conditions instead of using ignore_errors
- jinja[invalid] # Unrecognized type
- key-order[task] # You can improve the task key order
- meta-no-info # meta/main.yml should contain relevant info
- meta-no-tags # Tags must contain lowercase letters and digits only
- name[casing] #All names should start with an uppercase letter

View File

@@ -42,7 +42,8 @@
register: existing_vms
# NOTE(pas-ha) wrapping in block/rescue to have diagnostic output, requires Ansible>=2
- block:
- when: vm_name not in existing_vms.list_vms
block:
# NOTE(pas-ha) Ansible still lacks modules to operate on libvirt volumes
# NOTE(pas-ha) adding extra 1G for disk size to accomodate for partition table / configdrive
- name: create volume for vm
@@ -92,7 +93,6 @@
msg: >-
VM creation step failed, please review dmesg
output for additional details
when: vm_name not in existing_vms.list_vms
# TODO(pas-ha) replace 'command: vbmc ...' tasks
# with a custom Ansible module using vbmc Python API

View File

@@ -309,17 +309,18 @@
path: /tmp/sushy-emulator
register: redfish_emulator_old_state_dir
- block:
- become: true
ignore_errors: true
when:
- redfish_emulator_old_state_dir.stat.exists
- redfish_emulator_state_dir != '/tmp/sushy-emulator'
block:
- name: stop Redfish Emulator before migrating its state directory
systemd:
name: redfish-emulator
state: stopped
- name: migrate existing Redfish Emulator state directory
shell: mv /tmp/sushy-emulator/*.sqlite "{{ redfish_emulator_state_dir }}"
become: true
ignore_errors: true
when: redfish_emulator_old_state_dir.stat.exists
and redfish_emulator_state_dir != '/tmp/sushy-emulator'
- name: ensure Redfish Emulator systemd service is started and enabled
systemd:

View File

@@ -71,11 +71,13 @@
when: inventory_dhcp | bool or inventory_dns | bool
- name: "Create instance info"
when: instance_info is not defined or instance_info == {}
block:
- name: "Figure out image checksum"
when:
- deploy_image_checksum is not defined
- not deploy_image_source.startswith('file://')
block:
- name: "Collect the checksum of the deployment image."
stat:
path: "{{ deploy_image_path }}"
@@ -93,10 +95,6 @@
set_fact:
deploy_image_checksum: "{{ test_deploy_image.stat.checksum }}"
when:
- deploy_image_checksum is not defined
- not deploy_image_source.startswith('file://')
- name: "Set generated instance_info"
set_fact:
instance_info:
@@ -106,8 +104,6 @@
image_type: "{{ deploy_image_type | default(omit) }}"
root_gb: "{{ deploy_root_gb if deploy_image_type | default('') == 'partition' else omit }}"
when: instance_info is not defined or instance_info == {}
- name: "Deploy to hardware"
openstack.cloud.baremetal_node_action:
cloud: "{{ cloud_name | default(omit) }}"

View File

@@ -20,7 +20,8 @@
set_fact:
download_packages_string: "{{ download_packages | join(' ') }}"
- block:
- when: ansible_os_family == 'Debian'
block:
- name: "Download {{ download_packages_string }}"
command: apt-get download {{ download_packages_string }} # noqa: command-instead-of-module
args:
@@ -30,9 +31,9 @@
shell: >
dpkg-deb -R {{ download_dest }}/{{ item }}_*.deb {{ download_dest }}/{{ item }}
loop: "{{ download_packages }}"
when: ansible_os_family == 'Debian'
- block:
- when: ansible_os_family == 'RedHat'
block:
- name: "Download {{ download_packages_string }}"
command: >
dnf download --downloaddir {{ download_dest }} {{ download_packages_string }}
@@ -51,4 +52,3 @@
chdir: "{{ download_dest }}/{{ item }}"
executable: /bin/bash
loop: "{{ download_packages }}"
when: ansible_os_family == 'RedHat'

View File

@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
- block:
- delegate_to: localhost
block:
- name: "Find a suitable SSH public key"
set_fact:
ssh_public_key_path: "{{ item }}"
@@ -37,7 +38,6 @@
fail:
msg: "ssh_public_key_path {{ ssh_public_key_path }} was not found"
when: not test_ssh_public_key_path.stat.exists
delegate_to: localhost
- name: "Read SSH public key in ssh_public_key"
set_fact:

View File

@@ -401,7 +401,8 @@
- not create_ipa_image | bool
- download_ipa | bool
- block:
- when: use_cirros | bool
block:
- name: "Download cirros to use for deployment if requested"
get_url:
url: "{{ cirros_deploy_image_upstream_url }}"
@@ -418,9 +419,9 @@
owner: ironic
group: ironic
mode: "0644"
when: use_cirros | bool
- block:
- when: use_cirros | bool
block:
- name: "Create a checksum file for cirros"
shell: md5sum {{ deploy_image_filename }} > {{ deploy_image_filename }}.CHECKSUMS
args:
@@ -431,7 +432,6 @@
owner: ironic
group: ironic
mode: "0644"
when: use_cirros | bool
- name: "Bootstrap Nginx"
import_role:
@@ -522,7 +522,10 @@
- 6385
when: use_firewalld | bool
- block:
- when:
- ansible_os_family == 'RedHat'
- ansible_selinux.status == 'enabled'
block:
- name: "Allow nginx, ironic, inspector and IPA ports on SELinux"
seport:
ports: "{{ file_url_port }},{{ file_url_port_tls }},6385,5050,9999"
@@ -562,8 +565,6 @@
- "{{ http_boot_folder }}"
- "{{ tftp_boot_folder }}"
- "{{ ironic_tftp_master_path }}"
when: (ansible_os_family == 'RedHat' or ansible_os_family == 'Suse') and
ansible_selinux.status == 'enabled'
- name: "Configure remote logging"
template:

View File

@@ -142,6 +142,7 @@
- "{{ http_boot_folder }}"
- name: "Set up iPXE for EFI booting"
when: "'ipxe' in enabled_boot_interfaces.split(',')"
block:
- name: "Check if the iPXE EFI image is present"
stat:
@@ -177,8 +178,6 @@
mode: "0644"
remote_src: true
when: "'ipxe' in enabled_boot_interfaces.split(',')"
# Similar logic to below can be utilized to retrieve files
- name: "Determine if folder exists, else create and populate folder."
stat:

View File

@@ -18,7 +18,11 @@
update_cache: yes
when: ansible_os_family == 'Debian'
- block:
- name: "Enable EPEL repositories for known EL distributions"
when:
- enable_epel | bool
- ansible_distribution in ["AlmaLinux", "CentOS", "Rocky"]
block:
- name: "Enable powertools repository for EL8"
command: dnf config-manager --set-enabled powertools
when: ansible_distribution_version|int == 8
@@ -27,32 +31,27 @@
command: dnf config-manager --set-enabled crb
when: ansible_distribution_version|int == 9
- name: "Enable EPEL repository for EL7/8"
- name: "Enable EPEL repository for EL7/8/9"
ansible.builtin.dnf:
name: epel-release
state: latest
when:
- enable_epel | bool
- ansible_distribution in ["AlmaLinux", "CentOS", "Rocky"]
- name: "Enable EPEL repositories for EL9"
- name: "Enable EPEL-next repository for Centos 9-Stream"
ansible.builtin.dnf:
name:
- epel-next-release
name: epel-next-release
state: latest
when:
- enable_epel | bool
- ansible_distribution == 'CentOS'
- ansible_distribution_version|int == 9
- name: "Enable EPEL repository for RedHat 9"
command: dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
args:
creates: /etc/yum.repos.d/epel.repo
- name: "Enable EPEL repository for RHEL 9"
when:
- enable_epel | bool
- ansible_distribution == "RedHat"
- ansible_distribution_version|int >= 9
command: dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
args:
creates: /etc/yum.repos.d/epel.repo
- name: "Install system packages"
package:
@@ -206,8 +205,6 @@
dest: grub-efi
- src: "{{ shim_efi_package }}/{{ shim_efi_binary }}"
dest: shim-efi
when: ansible_os_family != 'Suse'
always:
- name: "Delete the temporary directory"
file:

View File

@@ -15,7 +15,9 @@
set_fact:
testing_cloud_name: "{{ (clouds | dict2items)[0].key }}"
- block:
- become: yes
become_user: "{{ user | default('root') }}"
block:
- name: "List bare metal nodes using CLI and clouds.yaml"
command: baremetal --debug node list
environment: "{{ bifrost_venv_env | combine({'OS_CLOUD': testing_cloud_name}) }}"
@@ -55,5 +57,3 @@
when:
- enable_keystone | bool
- "'bifrost-admin' in clouds"
become: yes
become_user: "{{ user | default('root') }}"

View File

@@ -242,7 +242,11 @@
group: "{{ nginx_user }}" # TODO(TheJulia): Split webserver user/group.
mode: "0755"
- block:
- when:
- ansible_os_family == 'RedHat'
- ansible_selinux.status == 'enabled'
- ansible_selinux.mode == "enforcing"
block:
- name: "Explicitly allow keystone port (TCP) on selinux"
seport:
ports: "5000"
@@ -266,7 +270,3 @@
- name: Enable keystone policy module
command: semodule -e keystone_policy
when:
- ansible_os_family == 'RedHat'
- ansible_selinux.status == 'enabled'
- ansible_selinux.mode == "enforcing"

View File

@@ -14,8 +14,8 @@
# limitations under the License.
---
- block:
- when: not skip_install | bool
block:
- name: "Check that sourcedir is provided with source_install"
fail:
msg: Source installation of requires sourcedir to be provided
@@ -69,5 +69,3 @@
extra_args: "{{ extra_args }}"
when: source_install | bool
environment: "{{ bifrost_venv_env | combine({'SETUPTOOLS_USE_DISTUTILS': 'stdlib'}) }}"
when: not skip_install | bool

View File

@@ -15,7 +15,8 @@
- name: "Set testing to true"
set_fact:
testing: true
- block:
- when: lookup('env', 'ZUUL_BRANCH') | length > 0
block:
- name: "Set variables if running in the CI"
set_fact:
cirros_deploy_image_upstream_url: file:///opt/cache/files/cirros-0.5.3-x86_64-disk.img
@@ -29,7 +30,6 @@
set_fact:
openstacksdk_source_install: true
when: sdk_path.stat.exists
when: lookup('env', 'ZUUL_BRANCH') | length > 0
- import_playbook: install.yaml