| --- |
| # postgresql molecule/default/verify.yml |
| # |
| # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| - name: Verify |
| hosts: all |
| tasks: |
| |
| # user/pw/db defined in converge.yaml |
| # docs: https://docs.ansible.com/ansible/latest/modules/postgresql_ping_module.html |
| - name: Check that user can connect to database |
| postgresql_ping: |
| login_host: "localhost" |
| db: "exampledb" |
| login_user: "exampleuser" |
| login_password: "examplepass" |
| |
| # docs: https://docs.ansible.com/ansible/latest/modules/postgresql_info_module.html |
| # default version is |
| - name: Check PostgreSQL Info |
| postgresql_info: |
| db: postgres |
| become: true |
| become_user: "postgres" |
| register: pgsql_info |
| |
| # print entire pgsql_info if needed |
| # - debug: var=pgsql_info |
| |
| - name: Verify PostgreSQL major version |
| assert: |
| that: |
| - pgsql_info['version']['major'] == 12 |