Zack Williams | 42a96fb | 2020-06-15 21:36:14 -0700 | [diff] [blame^] | 1 | --- |
| 2 | # postgresql molecule/default/verify.yml |
| 3 | # |
| 4 | # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | - name: Verify |
| 8 | hosts: all |
| 9 | tasks: |
| 10 | |
| 11 | # user/pw/db defined in converge.yaml |
| 12 | # docs: https://docs.ansible.com/ansible/latest/modules/postgresql_ping_module.html |
| 13 | - name: Check that user can connect to database |
| 14 | postgresql_ping: |
| 15 | login_host: "localhost" |
| 16 | db: "exampledb" |
| 17 | login_user: "exampleuser" |
| 18 | login_password: "examplepass" |
| 19 | |
| 20 | # docs: https://docs.ansible.com/ansible/latest/modules/postgresql_info_module.html |
| 21 | # default version is |
| 22 | - name: Check PostgreSQL Info |
| 23 | postgresql_info: |
| 24 | db: postgres |
| 25 | become: true |
| 26 | become_user: "postgres" |
| 27 | register: pgsql_info |
| 28 | |
| 29 | # print entire pgsql_info if needed |
| 30 | # - debug: var=pgsql_info |
| 31 | |
| 32 | - name: Verify PostgreSQL major version |
| 33 | assert: |
| 34 | that: |
| 35 | - pgsql_info['version']['major'] == 12 |