blob: bff685dc74700ee1e3d64c772bee71b359495e10 [file] [log] [blame]
Zack Williams42a96fb2020-06-15 21:36:14 -07001---
2# postgresql tasks/main.yml
3#
4# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
5# SPDX-License-Identifier: Apache-2.0
6
7- name: include OS-specific vars
8 include_vars: "{{ ansible_os_family }}.yml"
9
10- name: include OS-specific tasks
11 include_tasks: "{{ ansible_os_family }}.yml"
12
13# docs: https://docs.ansible.com/ansible/latest/modules/postgresql_user_module.html
14# using no_log to not expose the user's postgres password at runtime, see docs:
15# https://docs.ansible.com/ansible/latest/reference_appendices/logging.html
16- name: Create PostgreSQL Database Users
17 postgresql_user:
18 name: "{{ item.name }}"
19 password: "{{ item.password }}"
20 with_items: "{{ pgsql_users }}"
21 no_log: true
22 become: true
23 become_user: "{{ pgsql_unix_username }}"
24
25# docs: https://docs.ansible.com/ansible/latest/modules/postgresql_db_module.html
26- name: Create Databases
27 postgresql_db:
28 name: "{{ item.name }}"
29 owner: "{{ item.owner }}"
30 template: "template1"
31 with_items: "{{ pgsql_databases }}"
32 become: true
33 become_user: "{{ pgsql_unix_username }}"