Skip to content

Commit

Permalink
Merge pull request #164 from marios/ansible_lint
Browse files Browse the repository at this point in the history
 Add ansible-lint to github workflows action for pull requests
  • Loading branch information
ccamacho authored Sep 28, 2023
2 parents bd8e99c + 337d6fd commit faa03c9
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 15 deletions.
18 changes: 18 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions .github/workflows/ansible-lint.yaml
Original file line number Diff line number Diff line change
@@ -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/
6 changes: 3 additions & 3 deletions tests/playbooks/test_minimal.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: Prelude
hosts: local
gather_facts: no
gather_facts: false
module_defaults:
ansible.builtin.shell:
executable: /bin/bash
Expand All @@ -9,7 +9,7 @@

- name: Cleanup
hosts: local
gather_facts: no
gather_facts: false
module_defaults:
ansible.builtin.shell:
executable: /bin/bash
Expand All @@ -18,7 +18,7 @@

- name: Adoption
hosts: local
gather_facts: no
gather_facts: false
module_defaults:
ansible.builtin.shell:
executable: /bin/bash
Expand Down
6 changes: 3 additions & 3 deletions tests/playbooks/test_with_ceph.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: Prelude
hosts: local
gather_facts: no
gather_facts: false
module_defaults:
ansible.builtin.shell:
executable: /bin/bash
Expand All @@ -9,7 +9,7 @@

- name: Cleanup
hosts: local
gather_facts: no
gather_facts: false
module_defaults:
ansible.builtin.shell:
executable: /bin/bash
Expand All @@ -18,7 +18,7 @@

- name: Adoption
hosts: local
gather_facts: no
gather_facts: false
vars:
glance_backend: ceph
module_defaults:
Expand Down
1 change: 1 addition & 0 deletions tests/roles/backend_services/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/roles/dataplane_adoption/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -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
- pool.ntp.org
2 changes: 1 addition & 1 deletion tests/roles/dataplane_adoption/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
- name: Tenant
subnetName: subnet1
nodeTemplate:
ansibleSSHPrivateKeySecret: {{ ansibleSSHPrivateKeySecret }}
ansibleSSHPrivateKeySecret: {{ ansible_ssh_private_key_secret }}
managementNetwork: ctlplane
ansible:
ansiblePort: 22
Expand Down
2 changes: 1 addition & 1 deletion tests/roles/horizon_adoption/meta/main.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dependencies:
- role: common_defaults
- role: common_defaults
2 changes: 1 addition & 1 deletion tests/roles/horizon_adoption/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
register: horizon_http_status_code
until: horizon_http_status_code is success
retries: 15
delay: 2
delay: 2
3 changes: 1 addition & 2 deletions tests/roles/mariadb_copy/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}"

5 changes: 3 additions & 2 deletions tests/roles/prelude_local/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit faa03c9

Please sign in to comment.