test: fix syntax for ansible-lint
This commit is contained in:
parent
003f104851
commit
db4f38e578
3 changed files with 49 additions and 48 deletions
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: reload postgresql
|
- name: Reload postgresql
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: 'postgresql@{{ postgresql_version }}-main'
|
name: "postgresql@{{ postgresql_version }}-main"
|
||||||
state: reloaded
|
state: reloaded
|
||||||
|
|
|
@ -1,98 +1,99 @@
|
||||||
---
|
---
|
||||||
- name: install depencies packages
|
- name: Install depencies packages
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name:
|
name:
|
||||||
- gpg
|
- gpg
|
||||||
- python3-psycopg2
|
- python3-psycopg2
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
- import_tasks: repo.yml
|
- name: Import repo tasks
|
||||||
|
ansible.builtin.import_tasks: repo.yml
|
||||||
when: postgresql_use_official_repository
|
when: postgresql_use_official_repository
|
||||||
|
|
||||||
- name: install packages
|
- name: Install packages
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name:
|
name:
|
||||||
- 'postgresql-{{ postgresql_version }}'
|
- "postgresql-{{ postgresql_version }}"
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
- name: copy config
|
- name: Copy config
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: '{{ item }}.j2'
|
src: "{{ item }}.j2"
|
||||||
dest: '/etc/postgresql/{{ postgresql_version }}/main/{{ item }}'
|
dest: "/etc/postgresql/{{ postgresql_version }}/main/{{ item }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: "0644"
|
||||||
loop:
|
loop:
|
||||||
- postgresql.conf
|
- postgresql.conf
|
||||||
- pg_hba.conf
|
- pg_hba.conf
|
||||||
notify: reload postgresql
|
notify: Reload postgresql
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
- name: enable and start service
|
- name: Enable and start service
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: 'postgresql@{{ postgresql_version }}-main'
|
name: "postgresql@{{ postgresql_version }}-main"
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
- name: wait for service is up
|
- name: Wait for service is up
|
||||||
ansible.builtin.wait_for:
|
ansible.builtin.wait_for:
|
||||||
port: 5432
|
port: 5432
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
- name: manage users
|
- name: Manage users
|
||||||
community.general.postgresql_user:
|
community.general.postgresql_user:
|
||||||
name: '{{ item.key }}'
|
name: "{{ item.key }}"
|
||||||
password: '{{ item.value.password }}'
|
password: "{{ item.value.password }}"
|
||||||
role_attr_flags: '{{ item.value.attributes | default([]) | join(",") }}'
|
role_attr_flags: "{{ item.value.attributes | default([]) | join(',') }}"
|
||||||
state: '{{ item.value.state | default("present") }}'
|
state: "{{ item.value.state | default('present') }}"
|
||||||
loop: '{{ postgresql_users | dict2items }}'
|
loop: "{{ postgresql_users | dict2items }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: '{{ item.key }}'
|
label: "{{ item.key }}"
|
||||||
become: true
|
become: true
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
when: postgresql_primary
|
when: postgresql_primary
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
- name: manage databases
|
- name: Manage databases
|
||||||
community.general.postgresql_db:
|
community.general.postgresql_db:
|
||||||
name: '{{ item.name }}'
|
name: "{{ item.name }}"
|
||||||
encoding: '{{ item.encoding | default("UTF-8") }}'
|
encoding: "{{ item.encoding | default('UTF-8') }}"
|
||||||
state: '{{ item.state | default("present") }}'
|
state: "{{ item.state | default('present') }}"
|
||||||
lc_collate: '{{ item.lc_collate | default("C.UTF-8") }}'
|
lc_collate: "{{ item.lc_collate | default('C.UTF-8') }}"
|
||||||
lc_ctype: '{{ item.lc_ctype | default("C.UTF-8") }}'
|
lc_ctype: "{{ item.lc_ctype | default('C.UTF-8') }}"
|
||||||
template: '{{ item.template | default("template0") }}'
|
template: "{{ item.template | default('template0') }}"
|
||||||
owner: '{{ item.owner }}'
|
owner: "{{ item.owner }}"
|
||||||
loop: '{{ postgresql_databases }}'
|
loop: "{{ postgresql_databases }}"
|
||||||
become: true
|
become: true
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
when: postgresql_primary
|
when: postgresql_primary
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
- name: manage user's privileges
|
- name: Manage user"s privileges
|
||||||
community.postgresql.postgresql_privs:
|
community.postgresql.postgresql_privs:
|
||||||
db: '{{ item.database }}'
|
db: "{{ item.database }}"
|
||||||
roles: '{{ item.role }}'
|
roles: "{{ item.role }}"
|
||||||
type: '{{ item.type | default("table") }}'
|
type: "{{ item.type | default('table') }}"
|
||||||
objs: '{{ item.objets | default(["ALL_IN_SCHEMA"]) | join(",") }}'
|
objs: "{{ item.objets | default(['ALL_IN_SCHEMA']) | join(',') }}"
|
||||||
privs: '{{ item.privileges | join(",") }}'
|
privs: "{{ item.privileges | join(',') }}"
|
||||||
state: '{{ item.state | default("present") }}'
|
state: "{{ item.state | default('present') }}"
|
||||||
loop: '{{ postgresql_privileges }}'
|
loop: "{{ postgresql_privileges }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: '{{ item.role }}/{{ item.database }}'
|
label: "{{ item.role }}/{{ item.database }}"
|
||||||
become: true
|
become: true
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
when: postgresql_primary
|
when: postgresql_primary
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
- name: manage role membership
|
- name: Manage role membership
|
||||||
community.postgresql.postgresql_membership:
|
community.postgresql.postgresql_membership:
|
||||||
groups: '{{ item.value.groups }}'
|
groups: "{{ item.value.groups }}"
|
||||||
target_roles: '{{ item.key }}'
|
target_roles: "{{ item.key }}"
|
||||||
state: '{{ item.value.state | default("present") }}'
|
state: "{{ item.value.state | default('present') }}"
|
||||||
loop: '{{ postgresql_role_memberships | dict2items }}'
|
loop: "{{ postgresql_role_memberships | dict2items }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: '{{ item.key }}'
|
label: "{{ item.key }}"
|
||||||
become: true
|
become: true
|
||||||
become_user: postgres
|
become_user: postgres
|
||||||
when: postgresql_primary
|
when: postgresql_primary
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
---
|
---
|
||||||
- name: add official repository key
|
- name: Add official repository key
|
||||||
ansible.builtin.apt_key:
|
ansible.builtin.apt_key:
|
||||||
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
||||||
- name: add official repostiroy
|
- name: Add official repostiroy
|
||||||
ansible.builtin.apt_repository:
|
ansible.builtin.apt_repository:
|
||||||
filename: postgresql
|
filename: postgresql
|
||||||
repo: 'deb http://apt.postgresql.org/pub/repos/apt {{ ansible_distribution_release }}-pgdg main'
|
repo: "deb http://apt.postgresql.org/pub/repos/apt {{ ansible_distribution_release }}-pgdg main"
|
||||||
tags: postgresql
|
tags: postgresql
|
||||||
|
|
Loading…
Reference in a new issue