---
- name: "Ensure that lxc_php_version is defined"
  ansible.builtin.fail:
    msg: Please configure var lxc_php_version
  when: lxc_php_version is none


- ansible.builtin.include_role:
    name: evolix/lxc
  vars:
    lxc_containers:
      - { 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_container_name }}/rootfs"

- name: "Update APT cache in container {{ lxc_php_container_name }}"
  community.general.lxc_container:
    name: "{{ lxc_php_container_name }}"
    container_command: "apt-get update"

- ansible.builtin.import_tasks: "php56.yml"
  when: lxc_php_version == "php56"

- ansible.builtin.import_tasks: "php70.yml"
  when: lxc_php_version == "php70"

- ansible.builtin.import_tasks: "php73.yml"
  when: lxc_php_version == "php73"

- ansible.builtin.import_tasks: "php74.yml"
  when: lxc_php_version == "php74"

- ansible.builtin.import_tasks: "php80.yml"
  when: lxc_php_version == "php80"

- ansible.builtin.import_tasks: "php81.yml"
  when: lxc_php_version == "php81"

- ansible.builtin.import_tasks: "php82.yml"
  when: lxc_php_version == "php82"

- ansible.builtin.import_tasks: "php83.yml"
  when: lxc_php_version == "php83"

- ansible.builtin.import_tasks: "umask.yml"

- ansible.builtin.import_tasks: "misc.yml"
