browbeat/ansible/gather/roles/mysql/tasks/main.yml
Joe Talerico 8c668d51aa Gather script for containers
Currently our gather playbook assumes all configuration files will be in
/etc. This assumption isn't true with container deployments. Currently
the configuration files are located in
/var/lib/config-data/<service>/etc/<service>/.

The Gather script needs to support both container and non-container
deployments. This patchset updates the config parser python script
to check if a service is in the running containers list and then
determine it's appropriate path, grab all of multiple config files
in that path, then parse and drop them off for ansible to use.

This method automagically supports all possible mixes of containerized
uncontainerized services and will always grab the correct config even
if that changes build to build or run to run.

It's also easily extensible for many possible config locations or
different container types by adding another condition or additional
search paths.

Change-Id: I95a3059c7fc263733ac64aa894c6dbf11e2a909f
Closes-bug: #1701264
2017-07-13 10:02:13 -04:00

35 lines
1.2 KiB
YAML

---
#
# Get mysql facts
#
- name: Get max_connections on the database
shell: mysql -e "show variables like 'max_connections';" | grep max_connections | awk '{print $2}'
register: max_conn
ignore_errors: true
when: hostvars[inventory_hostname]['containers'] is not defined
- name: Get max_connections on the database
shell: docker exec mysql cat /etc/my.cnf.d/galera.cnf| grep max_connections | awk -F ' = ' '{print $2}'
register: max_conn_container
ignore_errors: true
when: hostvars[inventory_hostname]['containers'] is defined
- name: Set max database connections
set_fact:
openstack_mysql_max_connections: "{{ max_conn.stdout }}"
when: hostvars[inventory_hostname]['containers'] is not defined
- name: Set max database connections
set_fact:
openstack_mysql_max_connections: "{{ max_conn_container.stdout }}"
when: hostvars[inventory_hostname]['containers'] is defined
- name : Get file descriptors for the mysql process
shell: cat /proc/$(pgrep mysqld_safe)/limits | grep "open files" | awk '{print $4}'
register: mysql_desc
- name: Set file descriptors fact for mysql
set_fact:
openstack_mysql_file_descriptors: "{{ mysql_desc.stdout }}"