This role is only to test the action plugin and module postgresql exec and to demonstrate how idempotence can be developed at the Ansible task level.
Postgresql_exec allows SQL statements to be run against a Postgresql server using the psycopg2 Python library.
However, it is up to the user to maintain idempotence as the statements will be run on every run.
Copy the library directory and action plugins to your Ansible directories.
The paths for these plugins are set in ansible.cfg
e.g:-
action_plugins=./action_plugins
library=./library
This module is used to install postgres
https://github.com/ANXS/postgresql
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
Name | Description | Returned | type | Sample |
---|---|---|---|---|
changed | Returned when sql statement is executed correctly | optional | boolean | True |
msg | Capture any errors from SQL | optional | string | |
rows | List of rows from select | optional | list | |
rowfirst | First row of any result set | optional | string | |
statusmessage | http://initd.org/psycopg/docs/cursor.html | always | string | INSERT 1 |
rowcount | http://initd.org/psycopg/docs/cursor.html | always | int | 1 |
GPL3