lxc-php: Do not bind the mysql socket by default
continuous-integration/drone/pr Build is failing Details

The lxc-php role can be run on a server without mysql. Attempting to
bindmount the mysql socket in such a case cause the lxc container to
fail to start.

This commit add a variable, lxc_php_create_mysql_link defaulting to
false telling ansible if it should bindmount the MySQL socket to the
container.
This commit is contained in:
Mathieu Trossevin 2021-01-11 15:20:25 +01:00
parent 1576375417
commit 2e29dc2440
3 changed files with 5 additions and 4 deletions

View File

@ -8,6 +8,7 @@ php_conf_allow_url_fopen: "Off"
php_conf_disable_functions: "exec,shell-exec,system,passthru,popen"
# Allows accessing a local mysql database using localhost
lxc_php_create_mysql_link: False
php_conf_mysql_socket_dir: /mysqld
php_conf_mysql_default_socket: "{{ php_conf_mysql_socket_dir }}/mysqld.sock"

View File

@ -28,6 +28,6 @@
name: "{{ lxc_php_version }}"
container_config:
- "lxc.mount.entry = /run/mysqld {{ php_conf_mysql_socket_dir | replace('/', '', 1) }} none bind,create=dir 0 0"
when: php_conf_mysql_socket_dir is string
when: lxc_php_create_mysql_link and php_conf_mysql_socket_dir is string
notify: "Restart container"

View File

@ -24,8 +24,8 @@ dependencies:
- { 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/lxc-php, lxc_php_version: php56, lxc_php_create_mysql_link: True, when: "'php56' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php70, lxc_php_create_mysql_link: True, when: "'php70' in packweb_multiphp_versions" }
- { role: evolix/lxc-php, lxc_php_version: php73, lxc_php_create_mysql_link: True, 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 }