Skip to content

gilesw/ansible-postgresql_exec

Repository files navigation

ansible-postgresql_exec Build Status

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.

Installation

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

Requirements

This module is used to install postgres

https://github.com/ANXS/postgresql

Role Variables

Dependencies

Example Playbook

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 }

Return Values

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

License

GPL3

Author Information

https://github.com/gilesw

https://github.com/jirutka

About

Ansible module to run Postgres SQL statements with pycog2 forked from https://github.com/jirutka/ansible-modules

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published