Compare commits

...

2 commits

Author SHA1 Message Date
Brice Waegeneire 239065bf36 kvm-host: Fix regression on old Debian
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2640|6|2634|6|:-1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/399//ansiblelint">Evolix » ansible-roles » unstable #399</a>
gitea/ansible-roles/pipeline/head This commit looks good
2023-11-21 16:17:48 +01:00
Brice Waegeneire 736ed26036 lxc-php: Add variable 'lxc_php_container_name' 2023-11-21 16:13:07 +01:00
7 changed files with 23 additions and 22 deletions

View file

@ -231,7 +231,7 @@ EOT
if ! isDryRun; then
sleep 5
drbdadm status | tail -4
( drbdadm status || drbd-overview ) 2>/dev/null | tail -4
drbdDiskPath="/dev/drbd/by-res/${vmName}/0"
if ! [ -b "${drbdDiskPath}" ]; then

View file

@ -13,6 +13,7 @@ php_conf_mysql_socket_dir: /mysqld
php_conf_mysql_default_socket: "{{ php_conf_mysql_socket_dir }}/mysqld.sock"
lxc_php_version: Null
lxc_php_container_name: "php{{ lxc_php_version }}"
lxc_php_container_releases:
php56: "jessie"

View file

@ -1,11 +1,11 @@
---
- name: "{{ lxc_php_version }} - Install opensmtpd"
- name: "{{ lxc_php_container_name }} - Install opensmtpd"
community.general.lxc_container:
name: "{{ lxc_php_version }}"
name: "{{ lxc_php_container_name }}"
container_command: "DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y opensmtpd"
- name: "{{ lxc_php_version }} - Configure opensmtpd (in the container)"
- name: "{{ lxc_php_container_name }} - Configure opensmtpd (in the container)"
ansible.builtin.template:
src: smtpd.conf.j2
dest: "{{ lxc_rootfs }}/etc/smtpd.conf"
@ -14,7 +14,7 @@
when: lxc_php_container_releases[lxc_php_version] in ["jessie", "stretch", "buster"]
- name: "{{ lxc_php_version }} - Configure opensmtpd (in the container)"
- name: "{{ lxc_php_container_name }} - Configure opensmtpd (in the container)"
ansible.builtin.template:
src: smtpd.conf.bullseye.j2
dest: "{{ lxc_rootfs }}/etc/smtpd.conf"

View file

@ -1,11 +1,11 @@
---
- name: "{{ lxc_php_version }} - Install ssmtp"
- name: "{{ lxc_php_container_name }} - Install ssmtp"
community.general.lxc_container:
name: "{{ lxc_php_version }}"
name: "{{ lxc_php_container_name }}"
container_command: "DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends --yes --force-yes ssmtp "
- name: "{{ lxc_php_version }} - Configure ssmtp"
- name: "{{ lxc_php_container_name }} - Configure ssmtp"
ansible.builtin.template:
src: ssmtp.conf.j2
dest: "{{ lxc_rootfs }}/etc/ssmtp/ssmtp.conf"

View file

@ -9,16 +9,16 @@
name: evolix/lxc
vars:
lxc_containers:
- { name: "{{ lxc_php_version }}", release: "{{ lxc_php_container_releases[lxc_php_version] }}" }
- { name: "{{ lxc_php_container_name }}", release: "{{ lxc_php_container_releases[lxc_php_version] }}" }
when: lxc_php_version is defined
- name: set LXC rootfs
ansible.builtin.set_fact:
lxc_rootfs: "/var/lib/lxc/{{ lxc_php_version }}/rootfs"
lxc_rootfs: "/var/lib/lxc/{{ lxc_php_container_name }}/rootfs"
- name: "Update APT cache in container {{ lxc_php_version }}"
- name: "Update APT cache in container {{ lxc_php_container_name }}"
community.general.lxc_container:
name: "{{ lxc_php_version }}"
name: "{{ lxc_php_container_name }}"
container_command: "apt-get update"
- ansible.builtin.import_tasks: "php56.yml"

View file

@ -1,31 +1,31 @@
---
- name: "{{ lxc_php_version }} - Configure timezone for the container"
- name: "{{ lxc_php_container_name }} - Configure timezone for the container"
ansible.builtin.copy:
remote_src: yes
src: "/etc/timezone"
dest: "{{ lxc_rootfs }}/etc/timezone"
- name: "{{ lxc_php_version }} - Ensure container's root directory is 755"
- name: "{{ lxc_php_container_name }} - Ensure container's root directory is 755"
ansible.builtin.file:
path: "{{ lxc_rootfs }}"
state: directory
mode: '0755'
- name: "{{ lxc_php_version }} - Configure mailname for the container"
- name: "{{ lxc_php_container_name }} - Configure mailname for the container"
ansible.builtin.copy:
content: "{{ evolinux_hostname }}.{{ evolinux_domain }}\n"
dest: "{{ lxc_rootfs }}/etc/mailname"
notify: "Restart opensmtpd"
- name: "{{ lxc_php_version }} - Install misc packages"
- name: "{{ lxc_php_container_name }} - Install misc packages"
community.general.lxc_container:
name: "{{ lxc_php_version }}"
name: "{{ lxc_php_container_name }}"
container_command: "DEBIAN_FRONTEND=noninteractive apt install -y cron logrotate git zip unzip"
- name: "{{ lxc_php_version }} - Add MySQL socket to container default mounts"
- name: "{{ lxc_php_container_name }} - Add MySQL socket to container default mounts"
community.general.lxc_container:
name: "{{ lxc_php_version }}"
name: "{{ lxc_php_container_name }}"
container_config:
- "lxc.mount.entry = /run/mysqld {{ php_conf_mysql_socket_dir | replace('/', '', 1) }} none bind,create=dir 0 0"
when:

View file

@ -1,11 +1,11 @@
---
- name: "{{ lxc_php_version }} - Install PHP packages"
- name: "{{ lxc_php_container_name }} - Install PHP packages"
community.general.lxc_container:
name: "{{ lxc_php_version }}"
name: "{{ lxc_php_container_name }}"
container_command: "DEBIAN_FRONTEND=noninteractive apt install -y php-fpm php-cli php-gd php-intl php-imap php-ldap php-mysql php-pgsql php-sqlite3 php-gettext php-curl php-ssh2 php-zip php-mbstring php-zip composer libphp-phpmailer"
- name: "{{ lxc_php_version }} - Copy evolinux PHP configuration"
- name: "{{ lxc_php_container_name }} - Copy evolinux PHP configuration"
ansible.builtin.template:
src: z-evolinux-defaults.ini.j2
dest: "{{ line_item }}"