--- # # 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 }}"