You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

93 lines
2.5 KiB

---
- name: >
start proxysql container
requires docker sdk and docker daemon
--extra-vars "PROXYSQL_VERSION=2.0.18"
--extra-vars "mysql_connector=mysqlclient"
hosts: localhost
connection: local
tasks:
- name: >
start proxysql container for integration tests
community.docker.docker_container:
name: proxysql
image: "proxysql/proxysql:{{ PROXYSQL_VERSION | default('2.3.0') }}"
state: started
auto_remove: yes
recreate: yes
container_default_behavior: no_defaults
- name: add proxysql container temporary host group testing
add_host: hostname=proxysql groups=testing
- name: >
prepare proxysql container
basically installing requirements that are missing
in the official proxysql base image
currently it based on debian stretch
run integration tests against local proxysql container
changes on modules must be build and installed with ansible-galaxy
hosts: testing
connection: docker
vars:
ansible_python_interpreter: /usr/bin/python3
mysql_connector: pymysql
tasks:
- name: install pymysql requirements in docker container
when: "mysql_connector == 'pymysql'"
apt:
name:
- python3-pymysql
- python3-apt
- mariadb-client
state: present
update_cache: yes
- name: install mysqlclient requirements in docker container
when: "mysql_connector == 'mysqlclient'"
block:
- name: apt packages
apt:
name:
- python3-apt
- mariadb-client
- python3-dev
- default-libmysqlclient-dev
- build-essential
- python3-pip
state: present
update_cache: yes
- name: install mysqlclient
pip:
name: mysqlclient
- name: include roles for integrationtest itself
include_role:
name: "{{ item }}"
with_items:
- test_proxysql_info
- test_proxysql_backend_servers
- test_proxysql_global_variables
- test_proxysql_mysql_users
- test_proxysql_query_rules
- test_proxysql_query_rules_fast_routing
- test_proxysql_replication_hostgroups
- test_proxysql_scheduler
- name: >
stop docker container / clean up local environment
hosts: localhost
connection: local
tasks:
- name: stop proxysql container
community.docker.docker_container:
name: proxysql
state: stopped
container_default_behavior: no_defaults