From 0df015e9b5c4aefd4245c94ee98021d2af80ed99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Sat, 22 Oct 2022 16:41:45 +0200 Subject: lint: pass ansible-lint + yamllint --- roles/postgres/tasks/create_db.yml | 2 +- roles/postgres/tasks/create_user.yml | 2 +- roles/postgres/tasks/main.yml | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'roles/postgres/tasks') diff --git a/roles/postgres/tasks/create_db.yml b/roles/postgres/tasks/create_db.yml index 7a4fe6e..5f8db70 100644 --- a/roles/postgres/tasks/create_db.yml +++ b/roles/postgres/tasks/create_db.yml @@ -1,4 +1,4 @@ - name: create database # noqa: no-changed-when - command: createdb -U postgres -O "{{ postgres_db_user }}" "{{ postgres_db_name }}" + ansible.builtin.command: createdb -U postgres -O "{{ postgres_db_user }}" "{{ postgres_db_name }}" register: result failed_when: result.rc != 0 and "already exists" not in result.stderr diff --git a/roles/postgres/tasks/create_user.yml b/roles/postgres/tasks/create_user.yml index 4716939..483e507 100644 --- a/roles/postgres/tasks/create_user.yml +++ b/roles/postgres/tasks/create_user.yml @@ -1,4 +1,4 @@ - name: create database user # noqa: no-changed-when - command: createuser -U postgres "{{ postgres_db_user }}" + ansible.builtin.command: createuser -U postgres "{{ postgres_db_user }}" register: result failed_when: result.rc != 0 and "already exists" not in result.stderr diff --git a/roles/postgres/tasks/main.yml b/roles/postgres/tasks/main.yml index a203574..8046d40 100644 --- a/roles/postgres/tasks/main.yml +++ b/roles/postgres/tasks/main.yml @@ -1,12 +1,12 @@ - name: install postgres - package: + ansible.builtin.package: name: - postgresql-server - postgresql-contrib state: present - name: create postgres directories - file: + ansible.builtin.file: path: "{{ postgres_dir }}/{{ item }}" owner: "{{ postgres_user }}" group: "{{ postgres_group }}" @@ -17,13 +17,13 @@ - "data" - name: delete default data dir if exists - file: + ansible.builtin.file: path: "{{ postgres_default_dir }}" state: absent when: postgres_dir != "/var/postgresql" - name: link postgres directory to default one - file: + ansible.builtin.file: src: "{{ postgres_dir }}" dest: "{{ postgres_default_dir }}" owner: "{{ postgres_user }}" @@ -34,7 +34,7 @@ when: postgres_dir != "/var/postgresql" - name: init postgres database # noqa: no-changed-when - shell: + ansible.builtin.shell: cmd: | su "{{ postgres_user }}" \ -c 'initdb -D "{{ postgres_dir }}/data/" -U "{{ postgres_db_user }}" --encoding=UTF-8 --locale=en_US.UTF-8' @@ -45,7 +45,7 @@ - "'exists but is not empty' not in result.stderr" - name: enable and restart postgres service - service: + ansible.builtin.service: name: postgresql state: restarted enabled: true -- cgit v1.2.3