courseworkrep/roles/postgresql/tasks/databases.yml

18 lines
521 B
YAML
Raw Normal View History

2024-11-10 21:17:33 +00:00
- name: Create PostgreSQL database
community.postgresql.postgresql_db:
name: '{{ postgres_db }}'
owner: '{{ postgres_user }}'
encoding: UTF8
state: present
2024-11-18 20:52:42 +00:00
- name: Create contacts table
2024-11-10 21:17:33 +00:00
community.postgresql.postgresql_query:
db: '{{ postgres_db }}'
2024-11-13 20:18:44 +00:00
query: |
CREATE TABLE IF NOT EXISTS contacts (
id SERIAL PRIMARY KEY,
name VARCHAR(100),
phone_number VARCHAR(15) UNIQUE
);
2024-11-10 21:17:33 +00:00
login_user: '{{ postgres_user }}'
2024-11-13 20:18:44 +00:00
login_password: '{{ postgres_password }}'