timorunge.pmm_client
pmm_client
This role sets up and configures the Percona PMM Client.
Requirements
This role needs Ansible 2.5.0 or newer.
You can easily install a stable Ansible version using pip:
pip install ansible==2.8.4
All platform requirements are mentioned in the metadata file.
Install
To install the role, run:
ansible-galaxy install timorunge.pmm_client
Role Variables
Here are the variables you can use in this role and what they mean. For all variables, check defaults/main.yml.
# Version to use
# Type: Int
pmm_client_version: 1.17.1
# PMM server's IP address and port:
# Type: Str
pmm_client_server_host: 172.20.0.10
# Type: Int
pmm_client_server_port: 443
# Disable basic authentication:
# Type: Bool
pmm_client_server_basic_auth: false
# Use SSL:
# Type: Bool
pmm_client_server_use_ssl: true
# Force setup on initial configuration
# Type: Bool
pmm_client_force_setup: false
# Services to add or remove:
# Type: List
pmm_client_add_services:
- linux:metrics
- mysql:metrics
- mongodb:metrics
- postgresql:metrics
pmm_client_remove_services:
- mysql:queries
# Services to start or stop:
# Type: List
pmm_client_start_services:
- linux:metrics
- mysql:metrics
- mongodb:metrics
- postgresql:metrics
pmm_client_stop_services:
- mysql:queries
# MySQL database connection credentials:
# Type: Dict
pmm_client_db:
mysql:
host: localhost
port: 3306
username: root
password: toor
Examples
1) Install the PMM Client with no basic auth and no SSL
- hosts: all
become: yes
vars:
pmm_client_server_host: 172.20.0.10
pmm_client_server_port: 443
pmm_client_server_basic_auth: false
pmm_client_server_use_ssl: false
pmm_client_add_services:
- linux:metrics
pmm_client_start_services:
- linux:metrics
roles:
- timorunge.pmm_client
2) Install the PMM Client with basic auth and SSL enabled
- hosts: all
become: yes
vars:
pmm_client_server_host: 172.20.0.10
pmm_client_server_port: 443
pmm_client_server_basic_auth: true
pmm_client_server_basic_auth_username: admin
pmm_client_server_basic_auth_password: mySecurePassword
pmm_client_server_use_ssl: true
pmm_client_add_services:
- linux:metrics
pmm_client_start_services:
- linux:metrics
roles:
- timorunge.pmm_client
3) Install the PMM Client from a specific URL
- hosts: all
become: yes
vars:
pmm_client_version: 1.17.1
pmm_client_version_revision: 1
pmm_client_use_official_repo: false
pmm_client_debian_pkg: "https://www.percona.com/downloads/pmm/{{ pmm_client_version }}/binary/debian/{{ ansible_distribution_release }}/x86_64/pmm-client_{{ pmm_client_version }}-{{ pmm_client_version_revision }}.{{ ansible_distribution_release }}_amd64.deb"
roles:
- timorunge.pmm_client
4) Force setup of the PMM Client
Sometimes you need to force the setup of the PMM Client, for example if the server was unreachable or if you are re-using a hostname.
If you run into this issue, you will see a message indicating that the PMM Client is not configured.
You have two options to force the configuration:
1) Via YAML configuration
- hosts: all
become: yes
vars:
pmm_client_force_setup: true
roles:
- timorunge.pmm_client
2) Via command line
This method is recommended.
$ ansible-playbook main.yml -i inventory -b --limit "proxysql-aN8thi" --diff -e "{ pmm_client_force_setup: true }"
5) Uninstall the PMM Client
- hosts: all
become: yes
vars:
pmm_client_enabled: false
roles:
- timorunge.pmm_client
Testing
Tests are conducted using Docker with different environments, including:
- CentOS 7
- Debian 9.4 (Stretch)
- Ubuntu 16.04 (Xenial Xerus)
- Ubuntu 18.04 (Bionic Beaver)
Ansible version 2.8.4 is installed on all containers, and a test playbook is used.
To test locally, you can run:
curl https://raw.githubusercontent.com/timorunge/docker-test-runner/master/install.sh | sh
./docker_test_runner.py -f tests/docker_test_runner.yml
Dependencies
None
License
This role is licensed under the BSD 3-Clause "New" or "Revised" License.
Author Information
- Based on the original Ansible role by Chris Sam
- Heavily modified by: Timo Runge
Percona PMM Client for Debian and RedHat based distributions
ansible-galaxy install timorunge.pmm_client