courseworkrep/roles/postgresql/tasks/insert_data.yml
2024-11-13 23:18:44 +03:00

12 lines
411 B
YAML

- name: Insert data into PostgreSQL database idempotently
community.postgresql.postgresql_query:
db: '{{ postgres_db }}'
query: |
INSERT INTO contacts (name, phone_number) VALUES
('dima', '123123123'),
('vlad', '8800525252'),
('denis', '77777777')
ON CONFLICT (phone_number) DO NOTHING;
login_user: '{{ postgres_user }}'
login_password: '{{ postgres_password }}'