Skip to content
Snippets Groups Projects
Commit 04ed21e7 authored by Chris Croome's avatar Chris Croome
Browse files

debug test

parent 306d00c9
No related branches found
No related tags found
1 merge request!1Merge Sury
Pipeline #20579 failed
......@@ -15,7 +15,7 @@ php_versions:
phpdbg:
state: absent
'8.0':
state: present
state: absent
sapis:
apache2:
state: absent
......
......@@ -2,26 +2,18 @@
- name: PHP packages absent
block:
- name: PHP packages absent
- name: "PHP {{ version }} packages absent"
apt:
pkg: "php{{ version }}*"
state: absent
purge: true
autoclean: true
autoremove: true
loop: "{{ php_versions_remove }}"
loop_control:
loop_var: version
label: "{{ version }}"
- name: PHP config files absent
- name: "PHP {{ version }} config files absent"
file:
path: "/etc/php/{{ version }}/"
state: absent
loop: "{{ php_versions_remove }}"
loop_control:
loop_var: version
label: "{{ version }}"
tags:
- php
......
......@@ -2,9 +2,6 @@
- name: PHP checks
block:
# TODO
# - Check that when a version SAPI is set to present the version is also set to present
# - Check that when a version is set to absent the SAPIs are also set to absent, if the state is set
- name: Check that depreciated variables are not used
assert:
that:
......@@ -64,6 +61,14 @@
var: php_versions_remove
verbosity: 2
- name: Include SAPI checks for PHP proposed versions
include_tasks: sapi_checks.yml
loop: "{{ php_versions_remove }}"
loop_control:
loop_var: version
label: "{{ version }}"
when: ( php_versions_remove is defined ) and ( php_versions_remove != [] )
# - name: Include SAPI checks for PHP proposed versions
# include_tasks: sapi_checks.yml
# loop: "{{ php_proposed_versions }}"
......
......@@ -13,8 +13,20 @@
- name: Include package removal tasks
include_tasks: absent.yml
loop: "{{ php_versions_remove }}"
loop_control:
loop_var: version
label: "{{ version }}"
when: ( php_versions_remove is defined ) and ( php_versions_remove != [] )
- name: Include package install tasks
include_tasks: present.yml
loop: "{{ php_versions_install }}"
loop_control:
loop_var: version
label: "{{ version }}"
when: ( php_versions_install is defined ) and ( php_versions_install != [] )
- name: Debug fail
fail:
......
......@@ -7,26 +7,39 @@
var: version
verbosity: 2
- name: "Debug existing SAPIs for PHP {{ version }}"
debug:
var: ansible_local.phpquery.versions[version].sapis
verbosity: 3
when: ansible_local.phpquery.versions[version].sapis is defined
- name: "Set an array for the existing SAPIs for PHP {{ version }}"
set_fact:
php_existing_sapis: "{{ php_existing_sapis | default([]) }} + [ '{{ existing_sapi.key }}' ]"
when:
- ansible_local.phpquery.versions[version].sapis is defined
- existing_sapi.value.state == "present"
loop: "{{ ansible_local.phpquery.versions[version].sapis | dict2items }}"
- name: "Check that no SAPI is set to be present when PHP {{ version }} is set to be removed"
assert:
that:
- sapi.state == absent )
loop: "{{ php_versions[version].sapis }}"
loop_control:
loop_var: existing_sapi
label: "{{ existing_sapi.key }}"
loop_var: sapi
label:
when:
- php_versions[version].sapis is defined
- php_versions[version].sapis.sapi is defined
- php_versions[version].sapis.sapi.state is defined
- name: "Debug existing SAPIs for PHP {{ version }}"
debug:
var: php_existing_sapis
# - name: "Debug existing SAPIs for PHP {{ version }}"
# debug:
# var: ansible_local.phpquery.versions[version].sapis
# verbosity: 3
# when: ansible_local.phpquery.versions[version].sapis is defined
# - name: "Set an array for the existing SAPIs for PHP {{ version }}"
# set_fact:
# php_existing_sapis: "{{ php_existing_sapis | default([]) }} + [ '{{ existing_sapi.key }}' ]"
# when:
# - ansible_local.phpquery.versions[version].sapis is defined
# - existing_sapi.value.state == "present"
# loop: "{{ ansible_local.phpquery.versions[version].sapis | dict2items }}"
# loop_control:
# loop_var: existing_sapi
# label: "{{ existing_sapi.key }}"
# - name: "Debug existing SAPIs for PHP {{ version }}"
# debug:
# var: php_existing_sapis
# - name: Generate an array of proposed PHP SAPIs
# set_fact:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment