lxc-php: Make mysql socket binding work on fresh install

/var/run/mysqld only exist after mysql is installed, as such the role
lxc-php need to run after the role mysql.

Also only cause a restart of the containers when their configuration has
been changed.

For now socket binding might only work for mysql and not mysql-oracle
(it's default socket seems to be /tmp/mysql.sock).
This commit is contained in:
Mathieu Trossevin 2020-06-05 12:09:19 +02:00
parent 49b20f9b12
commit 5e13f8da4e
2 changed files with 10 additions and 3 deletions

View File

@ -29,3 +29,10 @@
container_config:
- "lxc.mount.entry = /var/run/mysqld {{ php_conf_mysql_socket_dir | replace('/', '', 1) }} none bind,create=dir 0 0"
when: php_conf_mysql_socket_dir is string
register: added_mysql_socket
- name: "{{ lxc_php_version }} - Restart container as configuration changed"
lxc_container:
name: "{{ lxc_php_version }}"
state: restarted
when: added_mysql_socket.changed

View File

@ -21,11 +21,11 @@ dependencies:
- { role: evolix/apache }
- { role: evolix/php, php_apache_enable: True, when: packweb_apache_modphp }
- { role: evolix/php, php_fpm_enable: True, when: packweb_apache_fpm }
- { role: evolix/lxc-php, lxc_php_version: php56, when: "'php56' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php70, when: "'php70' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php73, when: "'php73' in packweb_multiphp_versions" }
- { role: evolix/squid, squid_localproxy_enable: True }
- { role: evolix/mysql, when: packweb_mysql_variant == "debian" }
- { role: evolix/mysql-oracle, when: packweb_mysql_variant == "oracle" }
- { role: evolix/lxc-php, lxc_php_version: php56, when: "'php56' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php70, when: "'php70' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php73, when: "'php73' in packweb_multiphp_versions" }
- { role: evolix/webapps/evoadmin-web, evoadmin_enable_vhost: "{{ packweb_enable_evoadmin_vhost }}", evoadmin_multiphp_versions: "{{ packweb_multiphp_versions }}" }
- { role: evolix/evoacme }