2e29dc2440
Some checks failed
continuous-integration/drone/pr Build is failing
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.
34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
---
|
|
|
|
- name: "{{ lxc_php_version }} - Configure timezone for the container"
|
|
copy:
|
|
remote_src: yes
|
|
src: "/etc/timezone"
|
|
dest: "/var/lib/lxc/{{ lxc_php_version }}/rootfs/etc/timezone"
|
|
|
|
- name: "{{ lxc_php_version }} - Ensure container's root directory is 755"
|
|
file:
|
|
path: "/var/lib/lxc/{{ lxc_php_version }}/rootfs"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: "{{ lxc_php_version }} - Configure mailname for the container"
|
|
copy:
|
|
content: "{{ evolinux_hostname }}.{{ evolinux_domain }}\n"
|
|
dest: "/var/lib/lxc/{{ lxc_php_version }}/rootfs/etc/mailname"
|
|
notify: "Restart opensmtpd"
|
|
|
|
- name: "{{ lxc_php_version }} - Install misc packages"
|
|
lxc_container:
|
|
name: "{{ lxc_php_version }}"
|
|
container_command: "DEBIAN_FRONTEND=noninteractive apt install -y cron logrotate git zip unzip"
|
|
|
|
- name: "{{ lxc_php_version }} - Add MySQL socket to container default mounts"
|
|
lxc_container:
|
|
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: lxc_php_create_mysql_link and php_conf_mysql_socket_dir is string
|
|
notify: "Restart container"
|
|
|