From a90d2ffa31ea6ed97aaf59920d905abf5e772b6b Mon Sep 17 00:00:00 2001 From: juju4 Date: Sat, 14 Dec 2024 15:07:52 +0000 Subject: [PATCH] fix(php-conflict): check and fix update-alternatives php for 22.04 --- tasks/main.yml | 3 +++ tasks/php-conflict.yml | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tasks/php-conflict.yml diff --git a/tasks/main.yml b/tasks/main.yml index 3092770..d80ef6a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -52,6 +52,9 @@ ansible.builtin.import_tasks: nginx.yml when: misp_webserver is defined and misp_webserver == 'nginx' +- name: Import php-conflict + ansible.builtin.import_tasks: php-conflict.yml + - name: Ensure Random source is configured ansible.builtin.lineinfile: dest: /etc/default/rng-tools diff --git a/tasks/php-conflict.yml b/tasks/php-conflict.yml new file mode 100644 index 0000000..b3203ad --- /dev/null +++ b/tasks/php-conflict.yml @@ -0,0 +1,24 @@ +--- + +- name: Gather the package facts + ansible.builtin.package_facts: + manager: auto + +- name: List installed php packages + ansible.builtin.debug: + msg: "{{ item }}" + loop: "{{ ansible_facts.packages | select('match', '^php-*') | list }}" + +- name: Check debian alternatives + ansible.builtin.command: + cmd: update-alternatives --config php + become: yes + changed_when: false + +- name: Set debian alternatives + ansible.builtin.command: + cmd: update-alternatives --set php /usr/bin/php7.4 + become: yes + changed_when: false + when: + - (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version | int == 22)