Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jegj/ansible-role-pgagent
Install pg agent as Systemd unit on Ubuntu/Debian
https://github.com/jegj/ansible-role-pgagent
ansible debian pgagent postgresql systemd ubuntu
Last synced: 29 days ago
JSON representation
Install pg agent as Systemd unit on Ubuntu/Debian
- Host: GitHub
- URL: https://github.com/jegj/ansible-role-pgagent
- Owner: jegj
- License: mit
- Created: 2021-06-01T01:55:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-26T13:40:17.000Z (about 3 years ago)
- Last Synced: 2024-11-11T09:50:07.343Z (3 months ago)
- Topics: ansible, debian, pgagent, postgresql, systemd, ubuntu
- Homepage: https://galaxy.ansible.com/jegj/pgagent
- Size: 36.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Ansible Role pgAgent
=========[![CI Pipeline](https://github.com/jegj/ansible-role-pgagent/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jegj/ansible-role-pgagent/actions/workflows/ci.yml)
1) Install [pgAgent](https://www.pgadmin.org/docs/pgadmin4/development/pgagent.html) package.
2) Install( or Upgrade ) the pgAgent extension on the target database( if the database is local ).
3) Create a configuration file for the target database.
4) Start a pgAgent systemd unit for a target database.On a Debian/Ubuntu system.
Requirements
------------None
Role Variables
--------------pgagent_database: ""
Target database for pgAGent. **REQUIRED**, Otherwise the role will fail.
pgagent_database_port: 5432
Target database port for pgAgent. Default to `5432`.
pgagent_upgrade: false
Allow to upgrade `pgagent` apt package if required. Default to `false`.
pgagent_user: "postgres"
Target user for pgAgent. Default to `postgres`.
pgagent_hostaddr: "my.testdb"
Database Host address for pgAgent. **NO DEFINED**. By default the role use a local connection to the database.
pgagent_password: "myp4$$word"
User's password for pgAgent connection if is required. **NO DEFINED**. By default use postgres user with peer authentication.
Dependencies
------------None
Example Playbook
----------------```yaml
- hosts: dbserver
vars_files:
- vars/main.yml
roles:
- jegj.pgagent
```
pgAgent Unit Configuration File
----------------
The role will create a configuration file per database located at `/etc/pgagent/{{ your_db }}.conf` with the following configuration options:- `PG_AGENT_TARGET_PORT`: Postgres Database port.
- `PG_AGENT_HOST_ADDR`: Postgres Database host. If the connection is local this variable is not present.
- `PG_AGENT_USER`: Postgres Database user. Default to `postgres`.
- `PG_AGENT_LOG_VERBOSITY`: pgAgent Verbosity. Default to `1`(WARNING). Allowed values: (ERROR=0, WARNING=1, DEBUG=2).
- `PG_AGENT_RETRY_PERIOD`: pgAgent retry period after connection abort in seconds. Default to `30`.
- `PG_AGENT_POLL_INTERVAL`: pgAgent poll time interval in seconds. Default to `10`.Restart the pgagent unit for the target database to use the new configuration options with the following command:
```sh
sudo systemctl restart pgagent@{{ your_db }}
```Check [here](https://www.pgadmin.org/docs/pgadmin4/development/pgagent_install.html#daemon-installation-on-unix) for more information
To show stats about your pgAgent unit run:
```sh
sudo systemctl status pgagent@{{ your_db }}
```
pgAgent Log File
----------------
The pgAgent systemd unit will log to the file `/var/log/pgagent/{{ your_db }}.log` by default. There is also an entry at `/etc/logrotate.d/pgagent` that will rotate the log weekly by default.License
-------BSD
Author Information
------------------[Javier Galarza](https://jegj.github.io/resume/)