ansible-lint: Fix key-order[task]

Change-Id: I92c53b1c3f2695430e8f66b4add2ab7c070c7895
Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
This commit is contained in:
Michal Nasiadka
2025-11-21 08:18:32 -05:00
parent 02f8f9424a
commit 3d665fdb9d
11 changed files with 34 additions and 37 deletions

View File

@@ -9,8 +9,6 @@ skip_list:
# Galaxy changelog and runtime defined
- galaxy[no-changelog]
- galaxy[no-runtime]
# don't fail on when at the end of block
- key-order[task]
# All tasks should be named
- name[missing]
# Variables names from within roles should use role_name_ as a prefix

3
.gitignore vendored
View File

@@ -36,6 +36,9 @@ cover/
# Files created by reno build
releasenotes/build
# Files generated by ansible galaxy installs
.ansible/
# Others
.DS_Store
.vimrc

View File

@@ -1,5 +1,7 @@
---
- name: Install ceph-common
become: true
when: ansible_facts.os_family == 'Debian'
block:
- block:
- name: Ensure apt sources list directory exists
@@ -47,10 +49,9 @@
state: present
update_cache: true
when: ansible_facts.os_family == 'Debian'
become: true
- block:
- become: true
when: ansible_facts.os_family == 'RedHat'
block:
- name: Enable ceph yum repository
yum_repository:
name: ceph
@@ -76,6 +77,3 @@
name: "{{ ceph_yum_package }}"
state: present
enablerepo: epel
when: ansible_facts.os_family == 'RedHat'
become: true

View File

@@ -1,6 +1,7 @@
---
# TODO(inc0): Gates don't seem to have ufw executable, check for it instead of ignore errors
- block:
- when: disable_firewall | bool
block:
- name: Set firewall default policy
# noqa ignore-errors
become: true
@@ -29,7 +30,6 @@
when:
- ansible_facts.os_family == 'RedHat'
- firewalld_check.rc == 0
when: disable_firewall | bool
- import_role:
name: openstack.kolla.packages

View File

@@ -15,7 +15,8 @@
# APT starts Docker engine right after installation, which creates
# iptables rules before we disable iptables in Docker config
- block:
- when: ansible_facts.os_family == 'Debian'
block:
- name: Check if docker systemd unit exists
stat:
path: /etc/systemd/system/docker.service
@@ -30,7 +31,6 @@
state: link
become: true
when: not docker_unit_file.stat.exists
when: ansible_facts.os_family == 'Debian'
- name: Install packages
package:
@@ -44,7 +44,11 @@
# If any packages were updated, and any containers were running, wait for the
# daemon to come up and start all previously running containers.
- block:
- when:
- docker_install_result is changed
- running_containers.rc == 0
- running_containers.stdout != ''
block:
# At some point (at least on CentOS 7) Docker CE stopped starting
# automatically after an upgrade from legacy docker . Start it manually.
- name: Start docker
@@ -69,10 +73,6 @@
command: "docker start {{ running_containers.stdout }}"
become: true
changed_when: true
when:
- docker_install_result is changed
- running_containers.rc == 0
- running_containers.stdout != ''
- import_tasks: config.yml

View File

@@ -1,5 +1,9 @@
---
- name: Configure osbpo apt repository
when:
- ansible_facts.distribution == 'Debian'
- docker_sdk_python_externally_managed | default(false)
- virtualenv is none
block:
- name: Ensure apt sources list directory exists
file:
@@ -27,10 +31,6 @@
repo: "{{ docker_sdk_osbpo_apt_repo }}"
filename: osbpo
become: true
when:
- ansible_facts.distribution == 'Debian'
- docker_sdk_python_externally_managed | default(false)
- virtualenv is none
- name: Install packages
package:

View File

@@ -1,5 +1,6 @@
---
- name: Handling for Python3.10+ externally managed environments
when: ansible_facts.python.version.major == 3 and ansible_facts.python.version.minor >= 10
block:
- name: Get Python
ansible.builtin.command:
@@ -17,6 +18,4 @@
docker_sdk_python_externally_managed: true
when: python_externally_managed.stat.exists
when: ansible_facts.python.version.major == 3 and ansible_facts.python.version.minor >= 10
- include_tasks: "{{ package_action }}.yml"

View File

@@ -54,6 +54,7 @@
# every boot, which will break RabbitMQ. To prevent this happens, first we check whether cloud-init
# has been installed, and then set manage_etc_hosts to false.
- name: Check whether cloud-init has been installed, and ensure manage_etc_hosts is disabled
become: true
block:
- name: Check whether /etc/cloud/cloud.cfg exists
stat:
@@ -66,4 +67,3 @@
dest: /etc/cloud/cloud.cfg.d/99-kolla.cfg
mode: "0660"
when: cloud_init.stat.exists
become: true

View File

@@ -28,7 +28,11 @@
state: started
enabled: true
- block:
- when:
- podman_install_result.changed
- running_containers.rc == 0
- running_containers.stdout != ''
block:
- name: Wait for Podman to start
command: podman info
become: true
@@ -42,9 +46,5 @@
command: "podman start {{ running_containers.stdout }}"
become: true
changed_when: true
when:
- podman_install_result.changed
- running_containers.rc == 0
- running_containers.stdout != ''
- import_tasks: config.yml

View File

@@ -1,5 +1,10 @@
---
- name: Configure osbpo apt repository
become: true
when:
- ansible_facts.distribution == 'Debian'
- podman_sdk_python_externally_managed | default(false)
- virtualenv is none
block:
- name: Ensure apt sources list directory exists
file:
@@ -42,11 +47,6 @@
- name: Update the apt cache
apt:
update_cache: true
when:
- ansible_facts.distribution == 'Debian'
- podman_sdk_python_externally_managed | default(false)
- virtualenv is none
become: true
- name: Install packages
package:

View File

@@ -1,5 +1,6 @@
---
- name: Handling for Python3.10+ externally managed environments
when: ansible_facts.python.version.major == 3 and ansible_facts.python.version.minor >= 10
block:
- name: Get Python
ansible.builtin.command:
@@ -17,6 +18,4 @@
podman_sdk_python_externally_managed: true
when: python_externally_managed.stat.exists
when: ansible_facts.python.version.major == 3 and ansible_facts.python.version.minor >= 10
- include_tasks: "{{ package_action }}.yml"