Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
php
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
webarch
php
Commits
95ffd7da
Commit
95ffd7da
authored
2 years ago
by
Chris Croome
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
1aaaea11
No related branches found
No related tags found
1 merge request
!1
Merge Sury
Pipeline
#25775
passed
2 years ago
Stage: lint
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
defaults/main.yml
+22
-6
22 additions, 6 deletions
defaults/main.yml
tasks/pkg.yml
+62
-24
62 additions, 24 deletions
tasks/pkg.yml
vars/main.yml
+18
-16
18 additions, 16 deletions
vars/main.yml
with
102 additions
and
46 deletions
defaults/main.yml
+
22
−
6
View file @
95ffd7da
...
...
@@ -11,8 +11,10 @@ php_config:
memory_limit
:
"
512M"
php_sury
:
true
php_version
:
-
name
:
"
8.2"
state
:
absent
-
name
:
"
8.1"
state
:
pre
sent
state
:
ab
sent
pkg_absent
:
-
libapache2-mod-php
-
libapache2-mod-php8.1
...
...
@@ -35,7 +37,7 @@ php_version:
-
php8.1-xml
-
php8.1-xsl
-
name
:
"
8.0"
state
:
pre
sent
state
:
ab
sent
pkg_absent
:
-
libapache2-mod-php
-
libapache2-mod-php8.0
...
...
@@ -65,24 +67,38 @@ php_version:
-
php7.4-phpdbg
pkg_present
:
-
php7.4-apcu
-
php7.4-apcu-bc
-
php7.4-bcmath
-
php7.4-bz2
-
php7.4-cli
-
php7.4-c
ommon
-
php7.4-c
type
-
php7.4-curl
-
php7.4-fpm
-
php7.4-dom
-
php7.4-exif
-
php7.4-fileinfo
-
php7.4-gd
-
php7.4-geoip
-
php7.4-iconv
-
php7.4-imagick
-
php7.4-imap
-
php7.4-intl
-
php7.4-json
-
php7.4-ldap
-
php7.4-mbstring
-
php7.4-mysqli
-
php7.4-opcache
-
php7.4-readline
-
php7.4-pdo
-
php7.4-posix
-
php7.4-simplexml
-
php7.4-sqlite3
-
php7.4-readline
-
php7.4-tokenizer
-
php7.4-uploadprogress
-
php7.4-xml
-
php7.4-xmlreader
-
php7.4-xmlrpc
-
php7.4-xmlwriter
-
php7.4-xsl
-
php7.4-zip
-
name
:
"
7.3"
state
:
absent
-
name
:
"
7.2"
...
...
This diff is collapsed.
Click to expand it.
tasks/pkg.yml
+
62
−
24
View file @
95ffd7da
...
...
@@ -2,26 +2,54 @@
-
name
:
PHP packages configured
block
:
-
name
:
PHP versions absent
ansible.builtin.apt
:
pkg
:
"
php{{
php_ver
}}*"
state
:
absent
update_cache
:
true
cache_valid_time
:
60
autoclean
:
true
autoremove
:
true
purge
:
true
loop
:
"
{{
php_ver_absent
}}"
-
name
:
Debug PHP packages names listed as absent
ansible.builtin.debug
:
var
:
php_pkg_absent
verbosity
:
"
{%
if
ansible_check_mode
|
bool
%}0{%
else
%}1{%
endif
%}"
-
name
:
Set a fact for installed PHP packages that are listed as absent
ansible.builtin.set_fact
:
php_pkg_remove
:
"
{{
ansible_local.dpkg.installed
|
ansible.builtin.intersect(php_pkg_absent)
|
default
([])
}}"
-
name
:
Debug installed PHP packages that are listed as absent
ansible.builtin.debug
:
var
:
php_pkg_remove
verbosity
:
"
{%
if
ansible_check_mode
|
bool
%}0{%
else
%}1{%
endif
%}"
-
name
:
Debug PHP versions absent
ansible.builtin.debug
:
var
:
php_ver_absent
verbosity
:
"
{%
if
ansible_check_mode
|
bool
%}0{%
else
%}1{%
endif
%}"
-
name
:
Debug PHP versions absent regex
ansible.builtin.debug
:
var
:
php_ver_absent_regex
verbosity
:
"
{%
if
ansible_check_mode
|
bool
%}0{%
else
%}1{%
endif
%}"
-
name
:
Set a fact for PHP packages that should be removed due to their version
ansible.builtin.set_fact
:
php_ver_pkg_remove
:
"
{{
php_ver_pkg_remove
|
default
([])
+
ansible_local.dpkg.installed
|
select('regex',
php_regex)
}}"
loop
:
"
{{
php_ver_absent_regex
}}"
loop_control
:
loop_var
:
php_ver
register
:
php_versions_absent
when
:
-
php_pkg_absent is defined
-
php_pkg_absent != []
loop_var
:
php_regex
-
name
:
Debug installed PHP packages to remove due to their version
ansible.builtin.debug
:
var
:
php_ver_pkg_remove
verbosity
:
"
{%
if
ansible_check_mode
|
bool
%}0{%
else
%}1{%
endif
%}"
-
name
:
Set a fact for all installed PHP packages that should be removed
ansible.builtin.set_fact
:
php_pkg_rm
:
"
{{
php_pkg_remove
+
php_ver_pkg_remove
|
ansible.builtin.unique
}}"
-
name
:
Debug all installed PHP packages to be removed
ansible.builtin.debug
:
var
:
php_pkg_rm
verbosity
:
"
{%
if
ansible_check_mode
|
bool
%}0{%
else
%}1{%
endif
%}"
-
name
:
PHP packages absent
ansible.builtin.apt
:
pkg
:
"
{{
php_pkg_
absent
}}"
pkg
:
"
{{
php_pkg_
rm
}}"
state
:
absent
update_cache
:
true
cache_valid_time
:
60
...
...
@@ -29,22 +57,32 @@
autoremove
:
true
purge
:
true
register
:
php_packages_absent
when
:
-
php_pkg_absent is defined
-
php_pkg_absent != []
when
:
php_pkg_rm != []
-
name
:
Debug PHP packages present
ansible.builtin.debug
:
var
:
php_pkg_present
verbosity
:
"
{%
if
ansible_check_mode
|
bool
%}0{%
else
%}1{%
endif
%}"
-
name
:
Set a fact for PHP packages that should be installed
ansible.builtin.set_fact
:
php_pkg_install
:
"
{{
php_pkg_present
|
ansible.builtin.difference(ansible_local.dpkg.installed)
}}"
-
name
:
Debug PHP packages to install
ansible.builtin.debug
:
var
:
php_pkg_install
verbosity
:
"
{%
if
ansible_check_mode
|
bool
%}0{%
else
%}1{%
endif
%}"
-
name
:
PHP packages present
ansible.builtin.apt
:
pkg
:
"
{{
php_pkg_
present
}}"
pkg
:
"
{{
php_pkg_
install
}}"
state
:
latest
autoclean
:
true
autoremove
:
true
update_cache
:
true
cache_valid_time
:
60
register
:
php_packages_present
when
:
-
php_pkg_present is defined
-
php_pkg_present != []
register
:
php_packages_installed
when
:
php_pkg_install != []
-
name
:
Apt dist upgrade
ansible.builtin.apt
:
...
...
This diff is collapsed.
Click to expand it.
vars/main.yml
+
18
−
16
View file @
95ffd7da
---
# PHP versions absent
# cat defaults/main.yml | yq -o=json | jp "php_version[?state=='absent'].name"
php_ver_absent
:
"
{{
php_version
|
ansible.builtin.json_query('[?state==`absent`].name')
}}"
php_ver_absent_regex
:
"
{{
php_version
|
ansible.builtin.json_query('[?state==`absent`].name')
|
map('regex_replace',
'^',
'^php')
}}"
# PHP versions present
# cat defaults/main.yml | yq -o=json | jp "php_version[?state=='present'].name"
php_ver_present
:
"
{{
php_version
|
ansible.builtin.json_query('[?state==`present`].name')
}}"
# PHP packages absent
# cat defaults/main.yml | yq -o=json | jp "php_version[?state=='present'].pkg_absent[]" | sort -u
php_pkg_absent
:
"
{{
php_version
|
ansible.builtin.json_query('[?state==`present`].pkg_absent[]')
|
ansible.builtin.unique
|
sort
}}"
# PHP packages present
# cat defaults/main.yml | yq -o=json | jp "php_version[?state=='present'].pkg_present[]" | sort -u
php_pkg_present
:
"
{{
php_version
|
ansible.builtin.json_query('[?state==`present`].pkg_present[]')
|
ansible.builtin.unique
|
sort
}}"
# GPG public key URL linked from
# https://packages.sury.org/php/
php_gpg_url
:
https://packages.sury.org/php/apt.gpg
...
...
@@ -1669,20 +1687,4 @@ php_debian_buster_pkg:
-
python3-libxml2
-
python-libxml2
# PHP versions absent
# cat defaults/main.yml | yq -o=json | jp 'php_version[?state=="absent"].name'
php_ver_absent
:
"
{{
php_version
|
ansible.builtin.json_query('[?state==`absent`].name')
}}"
# PHP versions present
# cat defaults/main.yml | yq -o=json | jp 'php_version[?state=="present"].name'
php_ver_present
:
"
{{
php_version
|
ansible.builtin.json_query('[?state==`present`].name')
}}"
# PHP packages absent
# cat defaults/main.yml | yq -o=json | jp 'php_version[].pkg_absent[]'
php_pkg_absent
:
"
{{
php_version
|
ansible.builtin.json_query('[].pkg_absent[]')
|
ansible.builtin.unique
|
sort
}}"
# PHP packages present
# cat defaults/main.yml | yq -o=json | jp 'php_version[].pkg_present[]'
php_pkg_present
:
"
{{
php_version
|
ansible.builtin.json_query('[].pkg_present[]')
|
ansible.builtin.unique
|
sort
}}"
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment