Upgrade linters (ansible-lint v5)

Change-Id: I75562efd62fff9739d32f8b1b92e7826120e9d1a
This commit is contained in:
Sorin Sbarnea
2021-02-17 15:37:00 +00:00
parent d7e9ca5ba2
commit ac93fbbb47
37 changed files with 136 additions and 63 deletions

View File

@@ -2,18 +2,32 @@ exclude_paths:
- roles/validate-ui/.travis.yml - roles/validate-ui/.travis.yml
# we don't want to see failures from sideloaded repos # we don't want to see failures from sideloaded repos
- ../tripleo-upgrade/ - ../tripleo-upgrade/
parseable: true # parseable: true
quiet: false quiet: false
skip_list: skip_list:
# TODO(ssbarnea): Gradually remove these skips ASAP # TODO(ssbarnea): Gradually remove these skips ASAP
- 204 # Lines should be no longer than 160 chars - command-instead-of-module # Using command rather than module
- 302 # rm used in place of argument state=absent to file module - command-instead-of-shell # Use shell only when shell functionality is required
- 303 # sed used in place of template, replace or lineinfile module - deprecated-command-syntax # Using command rather than an argument to e.g. file
- 602 # Don't compare to empty string - deprecated-local-action # Do not use 'local_action', use 'delegate_to: localhost'
- 504 # Do not use 'local_action', use 'delegate_to: localhost' - empty-string-compare # Don't compare to empty string
- 701 # No 'galaxy_info' found - meta-no-info # meta/main.yml should contain relevant info
- 208 # [E208] File permissions unset or incorrect - no-changed-when # Commands should not change things if nothing needs doing
- 106 # [E106] Role name {} does not match ^[a-z][a-z0-9_]+$ pattern - no-jinja-nesting # Nested jinja pattern
- 207 # [E207] Nested jinja pattern - package-latest # Package installs should not use latest
- 306 # [E306] Shells that use pipes should set the pipefail option - risky-file-permissions # File permissions unset or incorrect
- risky-shell-pipe # Shells that use pipes should set the pipefail option
- role-name # Role name undercloud-setup does not match ``^[a-z][a-z0-9_]+$`` pattern
- yaml
verbosity: 1 verbosity: 1
mock_roles:
- collect-logs
- common
- environment/setup
- fetch-images
- libvirt/setup
- repo-setup
- tripleo
- tripleo-collect-logs
- tripleo-inventory
- tripleo-upgrade

View File

@@ -2,7 +2,7 @@
# to bump run: pre-commit autoupdate # to bump run: pre-commit autoupdate
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0 rev: v3.4.0
hooks: hooks:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
@@ -19,14 +19,14 @@ repos:
hooks: hooks:
- id: flake8 - id: flake8
- repo: https://github.com/adrienverge/yamllint.git - repo: https://github.com/adrienverge/yamllint.git
rev: v1.25.0 rev: v1.26.0
hooks: hooks:
- id: yamllint - id: yamllint
files: \.(yaml|yml)$ files: \.(yaml|yml)$
types: [file, yaml] types: [file, yaml]
entry: yamllint --strict -f parsable entry: yamllint --strict -f parsable
- repo: https://github.com/ansible/ansible-lint - repo: https://github.com/ansible/ansible-lint
rev: v4.3.7 rev: v5.0.3
hooks: hooks:
- id: ansible-lint - id: ansible-lint
always_run: true always_run: true

View File

@@ -5,6 +5,9 @@ rules:
line-length: line-length:
max: 180 max: 180
#braces: {min-spaces-inside: 1, max-spaces-inside: 10} # Ansible does not need --- prefix and none of other tools we use do
document-start: disable
# braces: {min-spaces-inside: 1, max-spaces-inside: 10}
ignore: | ignore: |
/roles/standalone/tasks/main.yml /roles/standalone/tasks/main.yml

View File

@@ -6,7 +6,8 @@
- freeipa-setup - freeipa-setup
tasks: tasks:
- include_role: - name: Include tripleo-inventory
include_role:
name: tripleo-inventory name: tripleo-inventory
vars: vars:
inventory: extra_node inventory: extra_node
@@ -29,7 +30,8 @@
- freeipa-setup - freeipa-setup
tasks: tasks:
- include_role: - name: Include repo-setup
include_role:
name: repo-setup name: repo-setup
vars: vars:
repo_setup_dir: /home/{{ supplemental_user|default('centos') }} repo_setup_dir: /home/{{ supplemental_user|default('centos') }}
@@ -43,5 +45,6 @@
become: true become: true
changed_when: false changed_when: false
- include_role: - name: Include freeipa-setup
include_role:
name: freeipa-setup name: freeipa-setup

View File

@@ -39,7 +39,8 @@
vars: vars:
validations_group: ['pre-introspection'] validations_group: ['pre-introspection']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)
@@ -78,7 +79,8 @@
vars: vars:
validations_group: ['pre-deployment'] validations_group: ['pre-deployment']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)

View File

@@ -29,7 +29,8 @@
vars: vars:
validations_group: ['post-deployment'] validations_group: ['post-deployment']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)

View File

@@ -15,7 +15,8 @@
vars: vars:
run_tripleo_validations_setup: true run_tripleo_validations_setup: true
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)

View File

@@ -45,7 +45,8 @@
hosts: virthost hosts: virthost
gather_facts: false gather_facts: false
tasks: tasks:
- include_role: - name: Include baremetal-prep-virthost
include_role:
name: baremetal-prep-virthost name: baremetal-prep-virthost
tasks_from: add_services_ports_firewalld.yml tasks_from: add_services_ports_firewalld.yml
when: when:
@@ -82,7 +83,8 @@
hosts: undercloud hosts: undercloud
gather_facts: false gather_facts: false
tasks: tasks:
- include_role: - name: Include baremetal-prep-virthost
include_role:
name: baremetal-prep-virthost name: baremetal-prep-virthost
tasks_from: remove_ens3.yml tasks_from: remove_ens3.yml
when: when:
@@ -93,7 +95,8 @@
hosts: undercloud hosts: undercloud
gather_facts: false gather_facts: false
tasks: tasks:
- include_role: - name: Name baremetal-prep-virthost
include_role:
name: baremetal-prep-virthost name: baremetal-prep-virthost
tasks_from: set_locale_UTF_8 tasks_from: set_locale_UTF_8
when: when:
@@ -141,14 +144,16 @@
cacheable: true cacheable: true
when: "'periodic' in zuul.job" when: "'periodic' in zuul.job"
- include_role: - name: Include build-test-packages
include_role:
name: build-test-packages name: build-test-packages
vars: vars:
artg_compressed_gating_repo: "/home/{{ undercloud_user }}/gating_repo.tar.gz" artg_compressed_gating_repo: "/home/{{ undercloud_user }}/gating_repo.tar.gz"
artg_repos_dir: "{{ repo_clone_dir|default('/opt/stack/new') }}" artg_repos_dir: "{{ repo_clone_dir|default('/opt/stack/new') }}"
when: build_test_packages|default(false)|bool when: build_test_packages|default(false)|bool
- include_role: - name: Include install-built-repo
include_role:
name: install-built-repo name: install-built-repo
vars: vars:
ib_create_web_repo: "{{ to_build|bool }}" ib_create_web_repo: "{{ to_build|bool }}"
@@ -164,18 +169,21 @@
modify_image_vc_cpu: 4 modify_image_vc_cpu: 4
modify_image_vc_verbose: true modify_image_vc_verbose: true
tasks: tasks:
- include_role: - name: Include fetch-images
include_role:
name: fetch-images name: fetch-images
when: not to_build|bool when: not to_build|bool
- include_role: - name: Include repo-setup
include_role:
name: repo-setup name: repo-setup
vars: vars:
repo_inject_image_path: "/home/{{ undercloud_user }}/overcloud-full.qcow2" repo_inject_image_path: "/home/{{ undercloud_user }}/overcloud-full.qcow2"
repo_run_live: false repo_run_live: false
when: not to_build|bool when: not to_build|bool
- include_role: - name: Include repo-setup
include_role:
name: repo-setup name: repo-setup
vars: vars:
repo_inject_image_path: "/home/{{ undercloud_user }}/ironic-python-agent.initramfs" repo_inject_image_path: "/home/{{ undercloud_user }}/ironic-python-agent.initramfs"
@@ -184,13 +192,15 @@
libguestfs_mode: false libguestfs_mode: false
when: not to_build|bool when: not to_build|bool
- include_role: - name: Include install-built-repo
include_role:
name: install-built-repo name: install-built-repo
vars: vars:
ib_repo_image_path: "/home/{{ undercloud_user }}/overcloud-full.qcow2" ib_repo_image_path: "/home/{{ undercloud_user }}/overcloud-full.qcow2"
when: compressed_gating_repo is defined and not to_build|bool when: compressed_gating_repo is defined and not to_build|bool
- include_role: - name: Include install-built-repo
include_role:
name: install-built-repo name: install-built-repo
vars: vars:
ib_repo_image_path: "/home/{{ undercloud_user }}/ironic-python-agent.initramfs" ib_repo_image_path: "/home/{{ undercloud_user }}/ironic-python-agent.initramfs"

View File

@@ -0,0 +1 @@
- hosts: localhost

View File

@@ -77,7 +77,8 @@
vars: vars:
validations_group: ['post-deployment'] validations_group: ['post-deployment']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)

View File

@@ -26,7 +26,8 @@
vars: vars:
validations_group: ['pre-introspection'] validations_group: ['pre-introspection']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)
@@ -50,7 +51,8 @@
vars: vars:
validations_group: ['pre-deployment'] validations_group: ['pre-deployment']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)

View File

@@ -33,7 +33,8 @@
vars: vars:
validations_group: ['post-deployment'] validations_group: ['post-deployment']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)

View File

@@ -14,7 +14,8 @@
tags: tags:
- standalone - standalone
tasks: tasks:
- include_role: - name: Include ipa-multinode ipaserver-subnode-install
include_role:
name: ipa-multinode name: ipa-multinode
tasks_from: ipaserver-subnode-install.yml tasks_from: ipaserver-subnode-install.yml
@@ -23,6 +24,7 @@
tags: tags:
- standalone - standalone
tasks: tasks:
- include_role: - name: Include ipa-multinode ipaserver-undercloud-setup
include_role:
name: ipa-multinode name: ipa-multinode
tasks_from: ipaserver-undercloud-setup.yml tasks_from: ipaserver-undercloud-setup.yml

View File

@@ -54,7 +54,8 @@
tags: tags:
- standalone - standalone
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- job.enable_validation|default(false)|bool - job.enable_validation|default(false)|bool

View File

@@ -77,7 +77,8 @@
tags: tags:
- tripleo-validations - tripleo-validations
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- job.enable_validation|default(false)|bool - job.enable_validation|default(false)|bool

View File

@@ -0,0 +1 @@
- hosts: localhost

1
playbooks/provision.yml Normal file
View File

@@ -0,0 +1 @@
- hosts: localhost

View File

@@ -34,7 +34,8 @@
vars: vars:
validations_group: ['pre-introspection'] validations_group: ['pre-introspection']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)
@@ -67,7 +68,8 @@
vars: vars:
validations_group: ['pre-deployment'] validations_group: ['pre-deployment']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)

View File

@@ -27,7 +27,8 @@
vars: vars:
validations_group: ['post-deployment'] validations_group: ['post-deployment']
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)

View File

@@ -14,7 +14,8 @@
hosts: undercloud hosts: undercloud
gather_facts: true gather_facts: true
tasks: tasks:
- include_role: - name: Include baremetal-prep-virthost
include_role:
name: baremetal-prep-virthost name: baremetal-prep-virthost
tasks_from: remove_ens3.yml tasks_from: remove_ens3.yml
when: when:

View File

@@ -36,7 +36,8 @@
vars: vars:
run_tripleo_validations_setup: true run_tripleo_validations_setup: true
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool) - (run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool)

1
playbooks/quickstart.yml Normal file
View File

@@ -0,0 +1 @@
- hosts: localhost

View File

@@ -0,0 +1 @@
- hosts: localhost

View File

@@ -0,0 +1 @@
- hosts: localhost

View File

@@ -0,0 +1 @@
- hosts: localhost

1
playbooks/teardown.yml Normal file
View File

@@ -0,0 +1 @@
- hosts: localhost

View File

@@ -2,5 +2,6 @@
- name: Decide whether we need to build images - name: Decide whether we need to build images
hosts: undercloud hosts: undercloud
tasks: tasks:
- include_role: - name: Include check-to-build-or-not-to-build
include_role:
name: check-to-build-or-not-to-build name: check-to-build-or-not-to-build

View File

@@ -6,7 +6,8 @@
- component-validations - component-validations
- tripleo-validations - tripleo-validations
tasks: tasks:
- include_role: - name: Include tripleo_validations
include_role:
name: tripleo_validations name: tripleo_validations
when: when:
- job.enable_validation|default(false)|bool - job.enable_validation|default(false)|bool

View File

@@ -71,7 +71,8 @@
failed_when: project_name_mapped.rc != 0 or not project_name_mapped.stdout failed_when: project_name_mapped.rc != 0 or not project_name_mapped.stdout
rescue: rescue:
- debug: - name: Display details in case of failure
debug:
msg: | msg: |
WARNING: Got {{ project_name_mapped.rc }} result code trying to build {{ artg_change.project }} WARNING: Got {{ project_name_mapped.rc }} result code trying to build {{ artg_change.project }}
--- STDERR --- --- STDERR ---

View File

@@ -1,5 +1,6 @@
--- ---
- set_fact: - name: set subnode_1_ip
set_fact:
subnode_1_ip: "{{ hostvars['subnode-1'].inventory_ip }}" subnode_1_ip: "{{ hostvars['subnode-1'].inventory_ip }}"
- name: set the freeipa_internal_ip - name: set the freeipa_internal_ip
@@ -9,7 +10,8 @@
standalone_control_virtual_ip: "{{ undercloud_network_cidr|nthhost(210) }}" standalone_control_virtual_ip: "{{ undercloud_network_cidr|nthhost(210) }}"
cacheable: true cacheable: true
- include_role: - name: Include repo-setup
include_role:
name: repo-setup name: repo-setup
vars: vars:
repo_setup_dir: /home/{{ ansible_user|default('centos') }} repo_setup_dir: /home/{{ ansible_user|default('centos') }}
@@ -149,7 +151,8 @@
ping -c 5 redhat.com ping -c 5 redhat.com
register: ping_output_com register: ping_output_com
- debug: - name: Display ping_output_com
debug:
msg: "{{ ping_output_com.stdout }}" msg: "{{ ping_output_com.stdout }}"
- name: Add DNS entries - name: Add DNS entries
@@ -177,8 +180,10 @@
ipa dnsrecord-show ooo.test overcloud ipa dnsrecord-show ooo.test overcloud
register: overcloud_record register: overcloud_record
- debug: - name: Display standalone_record
debug:
msg: "{{ standalone_record.stdout }}" msg: "{{ standalone_record.stdout }}"
- debug: - name: Display overcloud_record
debug:
msg: "{{ overcloud_record.stdout }}" msg: "{{ overcloud_record.stdout }}"

View File

@@ -1,5 +1,6 @@
--- ---
- set_fact: - name: set facts
set_fact:
subnode_1_ip: "{{ hostvars['subnode-1'].inventory_ip }}" subnode_1_ip: "{{ hostvars['subnode-1'].inventory_ip }}"
standalone_hostname: "standalone-0.{{ tripleo_domain }}" standalone_hostname: "standalone-0.{{ tripleo_domain }}"
tripleo_domain: ooo.test tripleo_domain: ooo.test
@@ -154,5 +155,6 @@
register: dig_ouput_com register: dig_ouput_com
ignore_errors: true ignore_errors: true
- debug: - name: Display dig_ouput_com
debug:
msg: "dig_ouput_com is {{ dig_ouput_com.stdout }}" msg: "dig_ouput_com is {{ dig_ouput_com.stdout }}"

View File

@@ -39,7 +39,8 @@
register: rpm_arch register: rpm_arch
changed_when: false changed_when: false
- debug: - name: Display rpm_arch result
debug:
msg: Package architecture is '{{ rpm_arch.stdout }}' msg: Package architecture is '{{ rpm_arch.stdout }}'
- name: Set contentdir to altarch - name: Set contentdir to altarch

View File

@@ -198,7 +198,8 @@
with_sequence: start=0 end="{{ (job.add_repos|length -1)|int }}" with_sequence: start=0 end="{{ (job.add_repos|length -1)|int }}"
register: add_repo_update_list_result register: add_repo_update_list_result
- debug: - name: Display add_repo_update_list
debug:
var: add_repo_update_list var: add_repo_update_list
- name: Add repos to update_repo - name: Add repos to update_repo
@@ -207,7 +208,8 @@
cacheable: true cacheable: true
when: add_repo_update_list_result|length > 0 when: add_repo_update_list_result|length > 0
- debug: - name: Display add_repos_update
debug:
var: add_repos_update var: add_repos_update
- name: Create string from list - name: Create string from list

View File

@@ -115,7 +115,8 @@
with_sequence: start=0 end="{{ (job.add_repos|length -1)|int }}" with_sequence: start=0 end="{{ (job.add_repos|length -1)|int }}"
register: add_repo_update_list_result register: add_repo_update_list_result
- debug: - name: Display add_repo_update_list
debug:
var: add_repo_update_list var: add_repo_update_list
- name: Add repos to update_repo - name: Add repos to update_repo
@@ -124,7 +125,8 @@
cacheable: true cacheable: true
when: add_repo_update_list_result|length > 0 when: add_repo_update_list_result|length > 0
- debug: - name: Display add_repos_update
debug:
var: add_repos_update var: add_repos_update
- name: Create string from list - name: Create string from list

View File

@@ -3,6 +3,7 @@
hosts: all hosts: all
gather_facts: false gather_facts: false
tasks: tasks:
- include_role: - name: Include validate-perf security_disable
include_role:
name: validate-perf name: validate-perf
tasks_from: security_disable tasks_from: security_disable

View File

@@ -27,5 +27,6 @@
poll: 0 poll: 0
changed_when: false changed_when: false
rescue: rescue:
- debug: - name: Display warning about performance
debug:
msg: "Warning: Performance cannot be validated." msg: "Warning: Performance cannot be validated."

View File

@@ -8,7 +8,8 @@
- name: unregister rhn via subscription manager - name: unregister rhn via subscription manager
redhat_subscription: state=absent redhat_subscription: state=absent
- debug: msg="All errors in this block are ignored" - name: Display message about ignoring errors
debug: msg="All errors in this block are ignored"
- name: ensure libvirt-python is installed - name: ensure libvirt-python is installed
yum: name=libvirt-python state=present yum: name=libvirt-python state=present