diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2022-10-22 16:41:45 +0200 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2022-10-22 16:41:45 +0200 |
commit | 0df015e9b5c4aefd4245c94ee98021d2af80ed99 (patch) | |
tree | d9dbf4259500857daf41b627dbc2d116ba92dbc1 /roles/postgres/tasks | |
parent | 1cd2d31e0d5f81ce066121de78c0ed042fc3b6aa (diff) | |
download | rules-0df015e9b5c4aefd4245c94ee98021d2af80ed99.tar.gz |
lint: pass ansible-lint + yamllint
Diffstat (limited to 'roles/postgres/tasks')
-rw-r--r-- | roles/postgres/tasks/create_db.yml | 2 | ||||
-rw-r--r-- | roles/postgres/tasks/create_user.yml | 2 | ||||
-rw-r--r-- | roles/postgres/tasks/main.yml | 12 |
3 files changed, 8 insertions, 8 deletions
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 |