From 8500ca5861725f1e9de4dce7d2274732210e6569 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Thu, 20 Feb 2025 11:30:55 +0100 Subject: [PATCH] Auto-fix yaml rules In order to reduce divergance with ansible-lint rules, we apply auto-fixing of violations. In current patch we replace all kind of truthy variables with `true` or `false` values to align with recommendations along with alignment of used quotes. With ansible-lint update it seems to be resolving symlink to absolute path, which causes our linter check to search for the wrong role name. Some more details were posted to ansible forum[1] So we apply change here to resolve failing CI. [1] https://forum.ansible.com/t/ansible-lint-resolving-symlinks-to-their-destinations/40388 Change-Id: Icdbe2bb4ad139254266d456cebba0c3f0c82496e --- .gitignore | 1 + defaults/main.yml | 4 ++-- examples/playbook.yml | 3 +-- molecule/default/converge.yml | 5 +++++ molecule/default/molecule.yml | 2 +- requirements.yml | 2 +- tasks/httpd_post_install.yml | 4 ++-- 7 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 molecule/default/converge.yml diff --git a/.gitignore b/.gitignore index 3a77206..c46a9ec 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ logs/* # OS generated files # ###################### ._* +.ansible .tox *.egg-info .eggs diff --git a/defaults/main.yml b/defaults/main.yml index 60abffa..21e157d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -93,7 +93,7 @@ httpd_pki_setup_host: "{{ openstack_pki_setup_host | default('localhost') }}" ## Create a certificate authority if one does not already exist httpd_pki_create_ca: "{{ openstack_pki_authorities is not defined | bool and httpd_pki_create_certificates }}" -httpd_pki_regen_ca: '' +httpd_pki_regen_ca: "" httpd_pki_authorities: - name: "HTTPDRoot" country: "GB" @@ -134,7 +134,7 @@ httpd_pki_certificates: "{{ _httpd_pki_generate_certificates_vhosts }}" httpd_pki_create_certificates: "{{ httpd_pki_certificates | length > 0 }}" httpd_pki_default_san: "{{ openstack_pki_san | default('DNS:' ~ ansible_facts['hostname'] ~ ',DNS:' ~ ansible_facts['fqdn']) }}" httpd_pki_keys_path: "{{ httpd_pki_dir ~ '/certs/private/' }}" -httpd_pki_regen_cert: '' +httpd_pki_regen_cert: "" httpd_pki_intermediate_cert_name: "{{ openstack_pki_service_intermediate_cert_name | default('HTTPDIntermediate') }}" httpd_pki_intermediate_cert_path: "{{ httpd_pki_dir ~ '/roots/' ~ httpd_pki_intermediate_cert_name ~ '/certs/' ~ httpd_pki_intermediate_cert_name ~ '.crt' }}" diff --git a/examples/playbook.yml b/examples/playbook.yml index 64dac51..5e8b001 100644 --- a/examples/playbook.yml +++ b/examples/playbook.yml @@ -1,6 +1,5 @@ --- - - name: Installing Apache Web Server hosts: httpd roles: - - role: "{{ playbook_dir | dirname | basename }}" + - role: httpd diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000..dcc2d12 --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,5 @@ +--- +- name: Installing Apache Web Server + hosts: httpd + roles: + - role: "{{ playbook_dir | dirname | dirname | basename }}" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 0324353..447389e 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -24,7 +24,7 @@ provisioner: name: ansible-lint playbooks: prepare: prepare.yml - converge: ../../examples/playbook.yml + converge: converge.yml verify: verify.yml inventory: links: diff --git a/requirements.yml b/requirements.yml index c56621e..90609d9 100644 --- a/requirements.yml +++ b/requirements.yml @@ -14,4 +14,4 @@ collections: - name: community.general source: https://github.com/ansible-collections/community.general type: git - version: 10.2.0 \ No newline at end of file + version: 10.2.0 diff --git a/tasks/httpd_post_install.yml b/tasks/httpd_post_install.yml index f12beb6..b08dead 100644 --- a/tasks/httpd_post_install.yml +++ b/tasks/httpd_post_install.yml @@ -76,7 +76,7 @@ - name: Remove Listen from Apache config ansible.builtin.lineinfile: dest: "{{ httpd_security_conf }}" - regexp: '^(Listen.*)' + regexp: "^(Listen.*)" backrefs: true - line: '#\1' + line: "#\\1" notify: Restart web server