From ec841d18a59ea2c086ddc682c26227a969f12048 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 6 Oct 2022 15:06:46 +0200 Subject: [PATCH] update molecule linting --- molecule/default/playbook.yml | 12 ++++++------ molecule/default/test_restic/tasks/main.yml | 12 ++++++------ .../test_restic/tasks/test_access_files.yml | 10 ++++++---- .../test_restic/tasks/test_backup_files.yml | 14 +++++++++----- .../default/test_restic/tasks/test_restic_link.yml | 5 +++-- molecule/default/verify.yml | 2 +- vars/main.yml | 2 +- 7 files changed, 32 insertions(+), 25 deletions(-) diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index 9d261ab..a00bc75 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -2,10 +2,10 @@ - name: Converge hosts: all roles: - - {role: ansible_role_restic} + - {role: ../../} pre_tasks: - - name: install bzip2 - package: + - name: Install bzip2 + ansible.builtin.package: name: bzip2 state: present vars: @@ -36,10 +36,10 @@ - name: Converge with dict hosts: all roles: - - role: ansible_role_restic + - {role: ../../} pre_tasks: - - name: install bzip2 - package: + - name: Install bzip2 + ansible.builtin.package: name: bzip2 state: present vars: diff --git a/molecule/default/test_restic/tasks/main.yml b/molecule/default/test_restic/tasks/main.yml index 21e1674..16d4a00 100644 --- a/molecule/default/test_restic/tasks/main.yml +++ b/molecule/default/test_restic/tasks/main.yml @@ -1,9 +1,9 @@ --- -- name: "include tasks for testing backup files" - include_tasks: "test_backup_files.yml" +- name: "Include tasks for testing backup files" + ansible.builtin.include_tasks: "test_backup_files.yml" -- name: "include tasks for testing access files" - include_tasks: "test_access_files.yml" +- name: "Include tasks for testing access files" + ansible.builtin.include_tasks: "test_access_files.yml" -- name: "include tasks for testing restic link" - include_tasks: "test_restic_link.yml" +- name: "Include tasks for testing restic link" + ansible.builtin.include_tasks: "test_restic_link.yml" diff --git a/molecule/default/test_restic/tasks/test_access_files.yml b/molecule/default/test_restic/tasks/test_access_files.yml index 4cb1fc5..6d53121 100644 --- a/molecule/default/test_restic/tasks/test_access_files.yml +++ b/molecule/default/test_restic/tasks/test_access_files.yml @@ -1,18 +1,20 @@ --- - name: Stat test access file - stat: + ansible.builtin.stat: path: /opt/restic/access-test.sh register: test_file + - name: Check that the test access file exists - assert: + ansible.builtin.assert: that: - test_file.stat.exists - name: Stat test_stdin access file - stat: + ansible.builtin.stat: path: /opt/restic/access-test_stdin.sh register: test_stdin_file + - name: Check that the test_stdin access file exists - assert: + ansible.builtin.assert: that: - test_stdin_file.stat.exists diff --git a/molecule/default/test_restic/tasks/test_backup_files.yml b/molecule/default/test_restic/tasks/test_backup_files.yml index c6fd0e8..fd0a0a1 100644 --- a/molecule/default/test_restic/tasks/test_backup_files.yml +++ b/molecule/default/test_restic/tasks/test_backup_files.yml @@ -1,27 +1,31 @@ --- - name: Stat test backup file - stat: + ansible.builtin.stat: path: /opt/restic/backup-test.sh register: test_file + - name: Check that the test backup file exists - assert: + ansible.builtin.assert: that: - test_file.stat.exists - name: Stat test_stdin backup file - stat: + ansible.builtin.stat: path: /opt/restic/backup-test_stdin.sh register: test_stdin_file + - name: Check that the test_stdin backup file exists - assert: + ansible.builtin.assert: that: - test_stdin_file.stat.exists - name: Run the backup scripts - shell: "./{{ item }}" + ansible.builtin.shell: "./{{ item }}" args: chdir: /opt/restic/ with_items: - backup-dicttest.sh - backup-test.sh - backup-test_stdin.sh + changed_when: true + tags: skip_ansible_lint_rule_command-instead-of-shell diff --git a/molecule/default/test_restic/tasks/test_restic_link.yml b/molecule/default/test_restic/tasks/test_restic_link.yml index eba08b2..55d2942 100644 --- a/molecule/default/test_restic/tasks/test_restic_link.yml +++ b/molecule/default/test_restic/tasks/test_restic_link.yml @@ -1,9 +1,10 @@ --- - name: Stat test restic link - stat: + ansible.builtin.stat: path: ~/restic/restic register: restic_link + - name: Check that the test restic link exists - assert: + ansible.builtin.assert: that: - restic_link.stat.exists diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index b468d1f..39c333c 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -4,5 +4,5 @@ hosts: all tasks: - name: "Include test_alpha-services" - include_role: + ansible.builtin.include_role: name: "test_restic" diff --git a/vars/main.yml b/vars/main.yml index 7b9d3f8..5f7a681 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -10,5 +10,5 @@ restic_os_variables: paths: - 'vars' -playbook_version_number: 25 # should be int +playbook_version_number: 26 # should be int playbook_version_path: 'do1jlr.restic.version'