Skip to content

Commit

Permalink
FQDN
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaassssiiee committed Oct 24, 2023
1 parent 3645bd4 commit d846ea2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
1 change: 0 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
skip_list:
- experimental # all rules tagged as experimental
- fqcn-builtins
6 changes: 3 additions & 3 deletions tasks/absent.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions tasks/prepare.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- name: Install ca-certificates
apt:
ansible.builtin.apt:
name: ca-certificates
register: network_access
until: network_access is success
Expand All @@ -13,7 +13,7 @@

- name: Install EPEL
when: ansible_os_family == 'RedHat'
yum:
ansible.builtin.yum:
name: epel-release
state: present
register: epel_install
Expand All @@ -23,7 +23,7 @@

- name: Install jmespath
# when: ansible_os_family == 'RedHat'
package:
ansible.builtin.package:
name: python3-jmespath
state: present
update_cache: true
Expand Down
16 changes: 8 additions & 8 deletions tasks/present.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}"
Expand All @@ -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
Expand All @@ -61,7 +61,7 @@
- base_goss

- name: Copy dgoss to remote
copy:
ansible.builtin.copy:
src: "dgoss"
dest: "{{ goss_path }}/dgoss"
mode: 0755
Expand All @@ -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 }}"
Expand All @@ -81,15 +81,15 @@
- 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
tags:
- base_goss

- name: Copy goss.yaml to remote
template:
ansible.builtin.template:
src: goss.yaml.j2
dest: "{{ goss_test_directory }}/goss.yaml"
mode: 0644
Expand Down
10 changes: 5 additions & 5 deletions tasks/verify.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- name: Ensure we have remote copy of goss
stat:
ansible.builtin.stat:
path: "{{ goss_dst }}"
register: goss_bin_remote
tags:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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

0 comments on commit d846ea2

Please sign in to comment.