From 557410f37683754f49fbfea1d8b30e97673f80f5 Mon Sep 17 00:00:00 2001 From: jgoutin Date: Sat, 3 Jun 2023 15:26:45 +0200 Subject: [PATCH] Fix ansible lint --- .ansible-lint | 8 +++----- changelogs/changelog.yaml | 2 ++ meta/runtime.yml | 2 +- roles/common/tasks/dnf.yml | 8 ++++---- roles/common/tasks/grub.yml | 10 +++++----- roles/postgresql/tasks/main.yml | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 changelogs/changelog.yaml diff --git a/.ansible-lint b/.ansible-lint index b841992..fd975d9 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -3,10 +3,8 @@ exclude_paths: - .github/ - tests skip_list: - - risky-file-permissions + - risky-file-permissions # Keep default file permission on modification by default + - var-naming[no-role-prefix] # Using "_" or "_*" names for temporary variables warn_list: - experimental - - schema[meta] - - name[template] - - galaxy[no-changelog] - - meta-runtime[unsupported-version] + - schema[meta] # Sometime, new Fedora versions are not present in valid schema values diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml new file mode 100644 index 0000000..52e7f38 --- /dev/null +++ b/changelogs/changelog.yaml @@ -0,0 +1,2 @@ +--- +releases: {} diff --git a/meta/runtime.yml b/meta/runtime.yml index e9c8ead..ce6befd 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,2 +1,2 @@ --- -requires_ansible: "~=2.14" +requires_ansible: ">=2.14.0" diff --git a/roles/common/tasks/dnf.yml b/roles/common/tasks/dnf.yml index da1f6a1..28870a2 100644 --- a/roles/common/tasks/dnf.yml +++ b/roles/common/tasks/dnf.yml @@ -9,14 +9,14 @@ - name: Check if DNF configuration was updated by RPM ansible.builtin.stat: path: /etc/dnf/dnf.conf.rpmnew - register: dnf_conf_rpmnew + register: _dnf_conf_rpmnew - name: Ensure latest DNF configuration from RPM is used ansible.builtin.copy: remote_src: true src: /etc/dnf/dnf.conf.rpmnew dest: /etc/dnf/dnf.conf - when: dnf_conf_rpmnew.stat.exists + when: _dnf_conf_rpmnew.stat.exists - name: Ensure DNF is configured community.general.ini_file: @@ -65,14 +65,14 @@ - name: Check if DNF automatic configuration was updated by RPM ansible.builtin.stat: path: /etc/dnf/automatic.conf.rpmnew - register: dnf_automatic_conf_rpmnew + register: _dnf_automatic_conf_rpmnew - name: Ensure latest DNF automatic configuration from RPM is used ansible.builtin.copy: remote_src: true src: /etc/dnf/automatic.conf.rpmnew dest: /etc/dnf/automatic.conf - when: dnf_automatic_conf_rpmnew.stat.exists + when: _dnf_automatic_conf_rpmnew.stat.exists - name: Ensure DNF automatic is configured community.general.ini_file: diff --git a/roles/common/tasks/grub.yml b/roles/common/tasks/grub.yml index 01a1c24..f3c6664 100644 --- a/roles/common/tasks/grub.yml +++ b/roles/common/tasks/grub.yml @@ -3,14 +3,14 @@ - name: Check if Grub default configuration was updated by RPM ansible.builtin.stat: path: /etc/default/grub.rpmnew - register: grub_default_rpmnew + register: _grub_default_rpmnew - name: Ensure latest Grub default configuration from RPM is used ansible.builtin.copy: remote_src: true src: /etc/default/grub.rpmnew dest: /etc/default/grub - when: grub_default_rpmnew.stat.exists + when: _grub_default_rpmnew.stat.exists - name: Ensure Grub options are configured ansible.builtin.lineinfile: @@ -42,8 +42,8 @@ install_weak_deps: false retries: 10 delay: 1 - register: pg_python3_pexpect - until: pg_python3_pexpect is successful + register: _pg_python3_pexpect + until: _pg_python3_pexpect is successful when: common_grub_password is defined - name: Ensure Grub password is set @@ -60,7 +60,7 @@ ansible.builtin.dnf: state: absent name: python3-pexpect - when: pg_python3_pexpect.changed # noqa no-handler + when: _pg_python3_pexpect.changed # noqa no-handler - name: Ensure Grub password is unset ansible.builtin.file: diff --git a/roles/postgresql/tasks/main.yml b/roles/postgresql/tasks/main.yml index 3e19404..552fa25 100644 --- a/roles/postgresql/tasks/main.yml +++ b/roles/postgresql/tasks/main.yml @@ -2,13 +2,13 @@ - name: Move the database directory from role < 1.3.0 to new the location if required block: - - name: Ensure the database is not installed directly in "{{ postgresql_data }}" directory + - name: Ensure the database is not installed directly in data directory ansible.builtin.stat: path: "{{ postgresql_data }}/PG_VERSION" register: pg_version_120 failed_when: pg_version_120.stat.exists rescue: - - name: 'Move the database from "{{ postgresql_data }}" to "{{ _data_subdir }}"' + - name: Move the database to a subdirectory ansible.builtin.command: "{{ item }}" args: creates: "{{ _data_subdir }}/PG_VERSION" @@ -82,7 +82,7 @@ name: postgres_socket state: present -- name: "Ensure {{ postgresql_user }} user is member of postgres_socket group" +- name: Ensure user is member of postgres_socket group ansible.builtin.user: name: "{{ postgresql_user }}" groups: postgres_socket