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/handlers/main.yml b/handlers/main.yml index 0a1e6a4..241e536 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,7 +1,7 @@ --- - name: Start cron - service: + ansible.builtin.service: name: crond state: started ... diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index d189587..5220c82 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -18,7 +18,7 @@ goss_format: tap tasks: - name: Download and install Goss - get_url: + ansible.builtin.get_url: url: "{{ goss_url }}" dest: "{{ goss_dst }}" checksum: "sha256:{{ goss_sha256sum }}" @@ -28,26 +28,26 @@ retries: 3 - name: Register test files - shell: "ls {{ goss_test_directory }}/test_*.yml" + ansible.builtin.shell: "ls {{ goss_test_directory }}/test_*.yml" changed_when: false register: test_files - name: Execute Goss tests environment: - # yamllint disable-line rule:line-length + # yamllint disable rule:line-length PATH: '/opt/rh/rh-git218/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' - command: "{{ goss_dst }} -g {{ item }} validate -f {{ goss_format }}" + ansible.builtin.command: "{{ goss_dst }} -g {{ item }} validate -f {{ goss_format }}" changed_when: false register: test_results with_items: "{{ test_files.stdout_lines }}" - name: Display details about the Goss results - debug: + ansible.builtin.debug: msg: "{{ item.stdout_lines }}" with_items: "{{ test_results.results }}" - name: Fail when tests fail - fail: + ansible.builtin.fail: msg: "Goss failed to validate" when: item.rc != 0 with_items: "{{ test_results.results }}" diff --git a/tasks/main.yml b/tasks/main.yml index 0f78f3a..4ab6a32 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,10 +2,10 @@ - name: Include OS-specific variables. # yamllint disable-line rule:line-length - include_vars: "{{ ansible_os_family }}{{ ansible_distribution_major_version }}.yml" + ansible.builtin.include_vars: "{{ ansible_os_family }}{{ ansible_distribution_major_version }}.yml" - name: Ensure goss directory exists - file: + ansible.builtin.file: path: /etc/goss.d/ state: directory owner: root @@ -15,7 +15,7 @@ - base_crontab - name: Copy goss tests template - template: + ansible.builtin.template: src: test_cron.yml.j2 dest: /etc/goss.d/test_cron.yml mode: 0640 @@ -23,19 +23,19 @@ - base_crontab - name: Ensure cron package is installed - package: + ansible.builtin.package: name: "{{ crontab_packages }}" state: present notify: Start cron - name: Ensure cron daemon is enabled - service: + ansible.builtin.service: name: "{{ crond_service }}" enabled: true state: started - name: Ensure permissions on /etc/crontab are configured - file: + ansible.builtin.file: dest: /etc/crontab owner: root group: root @@ -44,7 +44,7 @@ - permissions - name: Ensure permissions on cron directories are configured - file: + ansible.builtin.file: dest: "{{ item }}" state: directory owner: root @@ -61,14 +61,14 @@ - permissions - name: Remove /etc/at.deny - file: + ansible.builtin.file: path: /etc/at.deny state: absent tags: - crontab - name: Copy /etc/at.allow file - template: + ansible.builtin.template: src: at.allow.j2 dest: /etc/at.allow owner: root @@ -78,14 +78,14 @@ - crontab - name: Remove /etc/cron.deny - file: + ansible.builtin.file: path: /etc/cron.deny state: absent tags: - crontab - name: Copy /etc/cron.allow file - template: + ansible.builtin.template: src: cron.allow.j2 dest: /etc/cron.allow owner: root @@ -95,7 +95,7 @@ - crontab - name: Unconfigure jobs - cron: + ansible.builtin.cron: name: "{{ item.name }}" user: "{{ item.user | default('root') }}" state: absent @@ -106,7 +106,7 @@ - crontab - name: Configure jobs - cron: + ansible.builtin.cron: minute: "{{ item.value.minute | default('*') }}" hour: "{{ item.value.hour | default('*') }}" weekday: "{{ item.value.weekday | default('*') }}"