diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 000000000..e878f9ef9 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,18 @@ +profile: production +exclude_paths: + - mkdocs.yml + - docs/ + - tests/config/ + - tests/secrets.sample.yaml + - tests/vars.sample.yaml +skip_list: + - var-naming[no-role-prefix] + - yaml[line-length] + - risky-shell-pipe # we have pipefail set in common_defaults shell_header: + - name[casing] # do we want that one for consistency? maybe? + - no-changed-when # any point adding changed_when: false in all our shell? + - command-instead-of-shell +strict: false +quiet: false +verbosity: 2 +parseable: true diff --git a/.github/workflows/ansible-lint.yaml b/.github/workflows/ansible-lint.yaml new file mode 100644 index 000000000..fe050cb5d --- /dev/null +++ b/.github/workflows/ansible-lint.yaml @@ -0,0 +1,19 @@ +name: Ansible Lint +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + test: + name: Ansible Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run ansible-lint + uses: ansible/ansible-lint@main + env: + ANSIBLE_ROLES_PATH: /home/runner/work/data-plane-adoption/data-plane-adoption/tests/roles/ diff --git a/tests/playbooks/test_minimal.yaml b/tests/playbooks/test_minimal.yaml index 31248220c..d3283d978 100644 --- a/tests/playbooks/test_minimal.yaml +++ b/tests/playbooks/test_minimal.yaml @@ -1,6 +1,6 @@ - name: Prelude hosts: local - gather_facts: no + gather_facts: false module_defaults: ansible.builtin.shell: executable: /bin/bash @@ -9,7 +9,7 @@ - name: Cleanup hosts: local - gather_facts: no + gather_facts: false module_defaults: ansible.builtin.shell: executable: /bin/bash @@ -18,7 +18,7 @@ - name: Adoption hosts: local - gather_facts: no + gather_facts: false module_defaults: ansible.builtin.shell: executable: /bin/bash diff --git a/tests/playbooks/test_with_ceph.yaml b/tests/playbooks/test_with_ceph.yaml index 997a5079e..fe162b877 100644 --- a/tests/playbooks/test_with_ceph.yaml +++ b/tests/playbooks/test_with_ceph.yaml @@ -1,6 +1,6 @@ - name: Prelude hosts: local - gather_facts: no + gather_facts: false module_defaults: ansible.builtin.shell: executable: /bin/bash @@ -9,7 +9,7 @@ - name: Cleanup hosts: local - gather_facts: no + gather_facts: false module_defaults: ansible.builtin.shell: executable: /bin/bash @@ -18,7 +18,7 @@ - name: Adoption hosts: local - gather_facts: no + gather_facts: false vars: glance_backend: ceph module_defaults: diff --git a/tests/roles/backend_services/tasks/main.yaml b/tests/roles/backend_services/tasks/main.yaml index 1c6a16b07..d77fb8450 100644 --- a/tests/roles/backend_services/tasks/main.yaml +++ b/tests/roles/backend_services/tasks/main.yaml @@ -60,6 +60,7 @@ ansible.builtin.template: src: container_overrides.j2 dest: "../config/periodic_ci/container_image_overrides.yaml" + mode: '644' force: true - name: run kustomize and create controlplane with container overrides diff --git a/tests/roles/dataplane_adoption/defaults/main.yaml b/tests/roles/dataplane_adoption/defaults/main.yaml index da9723f16..689edd181 100644 --- a/tests/roles/dataplane_adoption/defaults/main.yaml +++ b/tests/roles/dataplane_adoption/defaults/main.yaml @@ -1,6 +1,6 @@ registry_name: "quay.io" registry_namespace: "podified-antelope-centos9" image_tag: "current-podified" -ansibleSSHPrivateKeySecret: dataplane-adoption-secret +ansible_ssh_private_key_secret: dataplane-adoption-secret default_edpm_chrony_ntp_servers: - - pool.ntp.org \ No newline at end of file + - pool.ntp.org diff --git a/tests/roles/dataplane_adoption/tasks/main.yaml b/tests/roles/dataplane_adoption/tasks/main.yaml index 4b4fc9e88..ea322280a 100644 --- a/tests/roles/dataplane_adoption/tasks/main.yaml +++ b/tests/roles/dataplane_adoption/tasks/main.yaml @@ -193,7 +193,7 @@ - name: Tenant subnetName: subnet1 nodeTemplate: - ansibleSSHPrivateKeySecret: {{ ansibleSSHPrivateKeySecret }} + ansibleSSHPrivateKeySecret: {{ ansible_ssh_private_key_secret }} managementNetwork: ctlplane ansible: ansiblePort: 22 diff --git a/tests/roles/horizon_adoption/meta/main.yaml b/tests/roles/horizon_adoption/meta/main.yaml index 2b5222050..610f184fb 100644 --- a/tests/roles/horizon_adoption/meta/main.yaml +++ b/tests/roles/horizon_adoption/meta/main.yaml @@ -1,2 +1,2 @@ dependencies: - - role: common_defaults \ No newline at end of file + - role: common_defaults diff --git a/tests/roles/horizon_adoption/tasks/main.yaml b/tests/roles/horizon_adoption/tasks/main.yaml index dc4e67b2f..4686badca 100644 --- a/tests/roles/horizon_adoption/tasks/main.yaml +++ b/tests/roles/horizon_adoption/tasks/main.yaml @@ -41,4 +41,4 @@ register: horizon_http_status_code until: horizon_http_status_code is success retries: 15 - delay: 2 \ No newline at end of file + delay: 2 diff --git a/tests/roles/mariadb_copy/tasks/main.yaml b/tests/roles/mariadb_copy/tasks/main.yaml index 65f81c609..f284c3fd6 100644 --- a/tests/roles/mariadb_copy/tasks/main.yaml +++ b/tests/roles/mariadb_copy/tasks/main.yaml @@ -46,9 +46,8 @@ no_log: "{{ use_no_log }}" ansible.builtin.shell: cmd: "{{ lookup('ansible.builtin.template', 'restore_dbs.bash') }}" - + - name: MariaDB post-checks no_log: "{{ use_no_log }}" ansible.builtin.shell: cmd: "{{ lookup('ansible.builtin.template', 'post_checks.bash') }}" - diff --git a/tests/roles/prelude_local/tasks/main.yaml b/tests/roles/prelude_local/tasks/main.yaml index a72dba4bd..e859e125a 100644 --- a/tests/roles/prelude_local/tasks/main.yaml +++ b/tests/roles/prelude_local/tasks/main.yaml @@ -1,8 +1,9 @@ -- import_tasks: sanity_checks.yaml +- name: import sanity checks + ansible.builtin.import_tasks: sanity_checks.yaml - name: clone install_yamls ansible.builtin.git: - repo: https://github.com/openstack-k8s-operators/install_yamls + repo: https://github.com/openstack-k8s-operators/install_yamls # noqa: latest[git] dest: "{{ install_yamls_path }}" when: - not install_yamls_makefile_stat.stat.exists