From d846ea23eb9bd5e438e1842a9eabf9b5760d9ecd Mon Sep 17 00:00:00 2001 From: Bas Meijer Date: Tue, 24 Oct 2023 22:09:37 +0200 Subject: [PATCH] FQDN --- .ansible-lint | 1 - tasks/absent.yml | 6 +++--- tasks/prepare.yml | 6 +++--- tasks/present.yml | 16 ++++++++-------- tasks/verify.yml | 10 +++++----- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 51b9e95..935a58c 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,4 +1,3 @@ --- skip_list: - experimental # all rules tagged as experimental - - fqcn-builtins diff --git a/tasks/absent.yml b/tasks/absent.yml index 9b2a6ef..9aa5cca 100644 --- a/tasks/absent.yml +++ b/tasks/absent.yml @@ -1,16 +1,16 @@ --- - name: "Remove {{ goss_test_directory }}" - file: + ansible.builtin.file: path: "{{ goss_test_directory }}" state: absent - name: Remove goss - file: + ansible.builtin.file: path: "{{ goss_path }}/goss" state: absent - name: Remove dgoss - file: + ansible.builtin.file: path: "{{ goss_path }}/dgoss" state: absent diff --git a/tasks/prepare.yml b/tasks/prepare.yml index 841f5e9..3a13f69 100644 --- a/tasks/prepare.yml +++ b/tasks/prepare.yml @@ -1,7 +1,7 @@ --- - name: Install ca-certificates - apt: + ansible.builtin.apt: name: ca-certificates register: network_access until: network_access is success @@ -13,7 +13,7 @@ - name: Install EPEL when: ansible_os_family == 'RedHat' - yum: + ansible.builtin.yum: name: epel-release state: present register: epel_install @@ -23,7 +23,7 @@ - name: Install jmespath # when: ansible_os_family == 'RedHat' - package: + ansible.builtin.package: name: python3-jmespath state: present update_cache: true diff --git a/tasks/present.yml b/tasks/present.yml index b76c6b6..f00885d 100644 --- a/tasks/present.yml +++ b/tasks/present.yml @@ -9,7 +9,7 @@ - name: Get goss binary become: false delegate_to: localhost - get_url: + ansible.builtin.get_url: url: "{{ goss_url }}" checksum: "sha256:{{ goss[goss_version].sha256sum }}" validate_certs: false @@ -25,14 +25,14 @@ - name: Ensure we have local copy of goss become: false delegate_to: localhost - stat: + ansible.builtin.stat: path: /tmp/goss register: goss_bin tags: - base_goss - name: Copy goss to remote - copy: + ansible.builtin.copy: src: "/tmp/goss" dest: "{{ goss_path }}/goss" owner: "{{ goss_user }}" @@ -44,7 +44,7 @@ - name: Get goss binary directly - get_url: + ansible.builtin.get_url: url: "{{ goss_url }}" checksum: "sha256:{{ goss[goss_version].sha256sum }}" validate_certs: false @@ -61,7 +61,7 @@ - base_goss - name: Copy dgoss to remote - copy: + ansible.builtin.copy: src: "dgoss" dest: "{{ goss_path }}/dgoss" mode: 0755 @@ -71,7 +71,7 @@ - base_goss - name: "Ensure presence of directory {{ goss_test_directory }}" - file: + ansible.builtin.file: path: "{{ goss_test_directory }}" state: directory owner: "{{ goss_user }}" @@ -81,7 +81,7 @@ - base_goss - name: Copy test_goss.yaml to remote - template: + ansible.builtin.template: src: test_goss.yaml.j2 dest: "{{ goss_test_directory }}/test_goss.yaml" mode: 0644 @@ -89,7 +89,7 @@ - base_goss - name: Copy goss.yaml to remote - template: + ansible.builtin.template: src: goss.yaml.j2 dest: "{{ goss_test_directory }}/goss.yaml" mode: 0644 diff --git a/tasks/verify.yml b/tasks/verify.yml index 25e0db2..9df713a 100644 --- a/tasks/verify.yml +++ b/tasks/verify.yml @@ -1,7 +1,7 @@ --- - name: Ensure we have remote copy of goss - stat: + ansible.builtin.stat: path: "{{ goss_dst }}" register: goss_bin_remote tags: @@ -15,7 +15,7 @@ - validate block: - name: Execute Goss tests - command: "{{ goss_dst }} validate -f json" + ansible.builtin.command: "{{ goss_dst }} validate -f json" args: chdir: "{{ goss_test_directory }}" register: test_results @@ -24,7 +24,7 @@ check_mode: false - name: Show failing Goss tests - debug: + ansible.builtin.debug: msg: "Goss test failed" loop: "{{ test_results.stdout | from_json | json_query(query) }}" vars: @@ -33,11 +33,11 @@ failed_when: test_results.rc != 0 - name: Execute Goss tests - command: "{{ goss_dst }} -g {{ goss_test_directory }}/goss.yaml validate -f {{ goss_format }}" + ansible.builtin.command: "{{ goss_dst }} -g {{ goss_test_directory }}/goss.yaml validate -f {{ goss_format }}" changed_when: false register: test_results - name: Report about the Goss results - debug: + ansible.builtin.debug: msg: "{{ test_results.stdout_lines }}" when: goss_report | bool