From 72b487e51ef9d65078d8856e87d746c9f14e6c47 Mon Sep 17 00:00:00 2001 From: "ansible-code-bot[bot]" <146274539+ansible-code-bot[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 15:29:56 +0000 Subject: [PATCH] Fix ansible-lint rule violations --- Gitea Deploy New Release.yml | 1 + Gitea New Release.yml | 1 + Web Install and Verification collections.yml | 12 +++---- Web Verification collections.yml | 1 + collections/requirements.yml | 2 +- roles/deploy_new_release/tasks/main.yml | 4 +-- roles/new_release/tasks/main.yml | 11 ++----- .../tasks/rhel_verification.yml | 2 +- roles/webservers_collection/tasks/main.yml | 5 ++- .../tasks/rhel_apache_collections.yml | 8 ++--- .../tasks/windows_iis_collections.yml | 32 +++++++++---------- 11 files changed, 38 insertions(+), 41 deletions(-) diff --git a/Gitea Deploy New Release.yml b/Gitea Deploy New Release.yml index ba8ca49..b112038 100644 --- a/Gitea Deploy New Release.yml +++ b/Gitea Deploy New Release.yml @@ -1,3 +1,4 @@ +--- - name: Deploy new Gitea release hosts: "{{ vm_name | default('all') }}" gather_facts: false diff --git a/Gitea New Release.yml b/Gitea New Release.yml index 73aa9bb..6ecd2ed 100644 --- a/Gitea New Release.yml +++ b/Gitea New Release.yml @@ -1,3 +1,4 @@ +--- - name: Create new Gitea release hosts: localhost gather_facts: false diff --git a/Web Install and Verification collections.yml b/Web Install and Verification collections.yml index e6de19a..4e52478 100644 --- a/Web Install and Verification collections.yml +++ b/Web Install and Verification collections.yml @@ -1,9 +1,9 @@ +--- - name: Install web server, insert an index page, verify service is started and that the index page appears hosts: "{{ vm_name | default('all') }}" gather_facts: false tasks: - - name: RHEL Apache config ansible.builtin.include_role: name: webservers_collection @@ -25,7 +25,7 @@ validate_certs: false return_content: true register: this - failed_when: "inventory_hostname not in this.content" + failed_when: inventory_hostname not in this.content when: os is match("rhel.*") or os == "Red Hat BYOL Linux" tags: - updaterhel @@ -36,14 +36,14 @@ validate_certs: false return_content: true register: this - failed_when: "inventory_hostname not in this.content" + failed_when: inventory_hostname not in this.content when: os is match("windows.*") or os is match("2016.*") or os == "Windows" tags: - updatewin - name: Print web address ansible.builtin.debug: - msg: "Web address is https://{{ ansible_host }}" + msg: Web address is https://{{ ansible_host }} - name: Set stats for the e-mail body and ServiceNow ansible.builtin.set_stats: @@ -52,8 +52,8 @@ work_notes: "[code]{{ fqdn }}[/code] " expose_to_cloud_redhat_com_results: "{{ fqdn }}: https://{{ ansible_host }}" - - name: Set stats for the e-mail subject # noqa run-once[task] + - name: Set stats for the e-mail subject # noqa run-once[task] ansible.builtin.set_stats: data: - email_subject: "Ansible VM Web Link" + email_subject: Ansible VM Web Link run_once: true diff --git a/Web Verification collections.yml b/Web Verification collections.yml index 276e674..b10ce20 100644 --- a/Web Verification collections.yml +++ b/Web Verification collections.yml @@ -1,3 +1,4 @@ +--- - name: Verify index page works hosts: "{{ vm_name | default('all') }}" gather_facts: false diff --git a/collections/requirements.yml b/collections/requirements.yml index 696c859..f65b592 100644 --- a/collections/requirements.yml +++ b/collections/requirements.yml @@ -1,5 +1,5 @@ +--- collections: - - name: ansible.windows - name: community.windows diff --git a/roles/deploy_new_release/tasks/main.yml b/roles/deploy_new_release/tasks/main.yml index bfd756b..bd98c8a 100644 --- a/roles/deploy_new_release/tasks/main.yml +++ b/roles/deploy_new_release/tasks/main.yml @@ -1,10 +1,10 @@ --- - name: Deploy a new application release ansible.builtin.unarchive: - src: "https://cicd.shadowman.dev:3000/api/v1/repos/{{ gitea_user }}/{{ repo }}/archive/{{ release_tag }}.tar.gz" + src: https://cicd.shadowman.dev:3000/api/v1/repos/{{ gitea_user }}/{{ repo }}/archive/{{ release_tag }}.tar.gz remote_src: true owner: root group: root - mode: '0755' + mode: "0755" dest: /var/www validate_certs: false diff --git a/roles/new_release/tasks/main.yml b/roles/new_release/tasks/main.yml index 68cbf86..52a190d 100644 --- a/roles/new_release/tasks/main.yml +++ b/roles/new_release/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Gather current app releases ansible.builtin.uri: - url: "https://cicd.shadowman.dev:3000/api/v1/repos/{{ gitea_user }}/{{ repo }}/releases" + url: https://cicd.shadowman.dev:3000/api/v1/repos/{{ gitea_user }}/{{ repo }}/releases method: GET user: "{{ gitea_user }}" password: "{{ gitea_password }}" @@ -17,18 +17,13 @@ - name: Create a Gitea Release using basic authentication ansible.builtin.uri: - url: "https://cicd.shadowman.dev:3000/api/v1/repos/{{ gitea_user }}/{{ repo }}/releases" + url: https://cicd.shadowman.dev:3000/api/v1/repos/{{ gitea_user }}/{{ repo }}/releases method: POST user: "{{ gitea_user }}" password: "{{ gitea_password }}" body_format: json force_basic_auth: true - body: - '{"target_commitish": "main", - "name": "Ansible Web App {{ tag }}", - "draft": false, - "prerelease": false, - "tag_name": "{{ tag }}"}' + body: '{"target_commitish": "main", "name": "Ansible Web App {{ tag }}", "draft": false, "prerelease": false, "tag_name": "{{ tag }}"}' status_code: 201 validate_certs: false register: __result diff --git a/roles/verification_collection/tasks/rhel_verification.yml b/roles/verification_collection/tasks/rhel_verification.yml index ca92ff3..bae7043 100644 --- a/roles/verification_collection/tasks/rhel_verification.yml +++ b/roles/verification_collection/tasks/rhel_verification.yml @@ -12,5 +12,5 @@ validate_certs: false return_content: true register: this - failed_when: "inventory_hostname not in this.content" + failed_when: inventory_hostname not in this.content when: os is match("rhel.*") or os == "Red Hat BYOL Linux" diff --git a/roles/webservers_collection/tasks/main.yml b/roles/webservers_collection/tasks/main.yml index 49c0059..8117c93 100644 --- a/roles/webservers_collection/tasks/main.yml +++ b/roles/webservers_collection/tasks/main.yml @@ -1,13 +1,12 @@ --- - - name: Setup webserver RHEL ansible.builtin.include_tasks: rhel_apache_collections.yml when: os is match("rhel.*") or os == "Red Hat BYOL Linux" tags: - - updaterhel + - updaterhel - name: Setup webserver Windows ansible.builtin.include_tasks: windows_iis_collections.yml when: os is match("windows.*") or os is match("2016.*") or os == "Windows" tags: - - updatewin + - updatewin diff --git a/roles/webservers_collection/tasks/rhel_apache_collections.yml b/roles/webservers_collection/tasks/rhel_apache_collections.yml index 5a3653e..27252e3 100644 --- a/roles/webservers_collection/tasks/rhel_apache_collections.yml +++ b/roles/webservers_collection/tasks/rhel_apache_collections.yml @@ -32,7 +32,7 @@ dest: /var/www/html/ owner: root group: root - mode: '0644' + mode: "0644" tags: - updaterhel @@ -42,7 +42,7 @@ dest: /etc/pki/tls/certs/localhost.crt owner: root group: root - mode: '0644' + mode: "0644" - name: Copy Key ansible.builtin.copy: @@ -50,7 +50,7 @@ dest: /etc/pki/tls/private/localhost.key owner: root group: root - mode: '0644' + mode: "0644" - name: Insert Index Page for webpage ansible.builtin.template: @@ -58,6 +58,6 @@ dest: /var/www/html/index.html owner: root group: root - mode: '0644' + mode: "0644" tags: - updaterhel diff --git a/roles/webservers_collection/tasks/windows_iis_collections.yml b/roles/webservers_collection/tasks/windows_iis_collections.yml index 0e95386..4ce3a9f 100644 --- a/roles/webservers_collection/tasks/windows_iis_collections.yml +++ b/roles/webservers_collection/tasks/windows_iis_collections.yml @@ -49,20 +49,20 @@ block: - name: Remove Default Site community.windows.win_iis_website: - name: 'Default Web Site' + name: Default Web Site state: absent rescue: - name: Remove Default Site again due to WINRM community.windows.win_iis_website: - name: 'Default Web Site' + name: Default Web Site state: absent - name: Configure site block: - name: Configure site community.windows.win_iis_website: - name: 'Ansible Tower' - physical_path: 'C:\inetpub\wwwroot' + name: Ansible Tower + physical_path: C:\inetpub\wwwroot state: started port: 80 ssl: true @@ -70,8 +70,8 @@ rescue: - name: Configure site twice due to WinRM community.windows.win_iis_website: - name: 'Ansible Tower' - physical_path: 'C:\inetpub\wwwroot' + name: Ansible Tower + physical_path: C:\inetpub\wwwroot state: started port: 80 ssl: true @@ -115,18 +115,18 @@ block: - name: Configure site bindings community.windows.win_iis_webbinding: - name: 'Ansible Tower' - port: '443' - protocol: 'https' - certificate_hash: '{{ thumbprint.thumbprints[0] }}' - state: 'present' + name: Ansible Tower + port: "443" + protocol: https + certificate_hash: "{{ thumbprint.thumbprints[0] }}" + state: present notify: IIS_running rescue: - name: Configure site bindings twice due to WINRM issues community.windows.win_iis_webbinding: - name: 'Ansible Tower' - port: '443' - protocol: 'https' - certificate_hash: '{{ thumbprint.thumbprints[0] }}' - state: 'present' + name: Ansible Tower + port: "443" + protocol: https + certificate_hash: "{{ thumbprint.thumbprints[0] }}" + state: present notify: IIS_running