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
6a15414d
Commit
6a15414d
authored
2 years ago
by
Chris Croome
Browse files
Options
Downloads
Patches
Plain Diff
update-alternatives fsct script added
parent
e2611591
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
Merge Sury
Pipeline
#20926
failed
2 years ago
Stage: lint
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tasks/local_facts.yml
+10
-1
10 additions, 1 deletion
tasks/local_facts.yml
templates/php_alternatives.fact.j2
+67
-0
67 additions, 0 deletions
templates/php_alternatives.fact.j2
with
77 additions
and
1 deletion
tasks/local_facts.yml
+
10
−
1
View file @
6a15414d
...
...
@@ -35,10 +35,19 @@
group
:
root
register
:
php_phpquery_facts
-
name
:
Ansible PHP update-alternatives local facts script present
ansible.builtin.template
:
src
:
php_alternatives.fact.j2
dest
:
/etc/ansible/facts.d/php_alternatives.fact
mode
:
0700
owner
:
root
group
:
root
register
:
php_alternatives_facts
-
name
:
Re-read Ansible local facts
ansible.builtin.setup
:
filter
:
ansible_local
when
:
( php_dpkg_arch_facts.changed ) or ( php_phpquery_facts.changed )
when
:
( php_dpkg_arch_facts.changed ) or ( php_phpquery_facts.changed )
or ( php_alternatives_facts.changed )
-
name
:
Print Ansible dpkg --architecture variables
debug
:
...
...
This diff is collapsed.
Click to expand it.
templates/php_alternatives.fact.j2
0 → 100644
+
67
−
0
View file @
6a15414d
#!/usr/bin/env bash
{{
ansible_managed
}}
set
-euo
pipefail
jo
$(
if
[[
-L
"/usr/bin/php"
]]
then
echo
php
=
$(
declare
-a
alternatives
=()
readarray
-t
alternatives < <
(
update-alternatives
--query
php |
grep
-e
'^Alternative'
|
sed
's;Alternative: /usr/bin/php;;'
)
declare
-a
priorities
=()
readarray
-t
priorities < <
(
update-alternatives
--query
php |
grep
-e
'^Priority'
|
sed
's/Priority: //'
)
jo
$(
for
i
in
$(
seq
0
$((
"
${#
alternatives
[@]
}
"
-
1
))
)
do
echo
"
${
alternatives
[
${
i
}
]
}
=
${
priorities
[
${
i
}
]
}
"
done
)
)
fi
if
[[
-L
"/usr/bin/phar"
]]
then
echo
phar
=
$(
declare
-a
alternatives
=()
readarray
-t
alternatives < <
(
update-alternatives
--query
phar |
grep
-e
'^Alternative'
|
sed
's;Alternative: /usr/bin/phar;;'
)
declare
-a
priorities
=()
readarray
-t
priorities < <
(
update-alternatives
--query
phar |
grep
-e
'^Priority'
|
sed
's/Priority: //'
)
jo
$(
for
i
in
$(
seq
0
$((
"
${#
alternatives
[@]
}
"
-
1
))
)
do
echo
"
${
alternatives
[
${
i
}
]
}
=
${
priorities
[
${
i
}
]
}
"
done
)
)
fi
if
[[
-L
"/usr/bin/phar.phar"
]]
then
echo
phar.phar
=
$(
declare
-a
alternatives
=()
readarray
-t
alternatives < <
(
update-alternatives
--query
phar.phar |
grep
-e
'^Alternative'
|
sed
's;Alternative: /usr/bin/phar.phar;;'
)
declare
-a
priorities
=()
readarray
-t
priorities < <
(
update-alternatives
--query
phar.phar |
grep
-e
'^Priority'
|
sed
's/Priority: //'
)
jo
$(
for
i
in
$(
seq
0
$((
"
${#
alternatives
[@]
}
"
-
1
))
)
do
echo
"
${
alternatives
[
${
i
}
]
}
=
${
priorities
[
${
i
}
]
}
"
done
)
)
fi
if
[[
-L
"/run/php/php-fpm.sock"
]]
then
echo
php-fpm.sock
=
$(
declare
-a
alternatives
=()
readarray
-t
alternatives < <
(
update-alternatives
--query
php-fpm.sock |
grep
-e
'^Alternative'
|
sed
's;Alternative: /run/php/php;;'
|
sed
's/-fpm.sock$//'
)
declare
-a
priorities
=()
readarray
-t
priorities < <
(
update-alternatives
--query
php-fpm.sock |
grep
-e
'^Priority'
|
sed
's/Priority: //'
)
jo
$(
for
i
in
$(
seq
0
$((
"
${#
alternatives
[@]
}
"
-
1
))
)
do
echo
"
${
alternatives
[
${
i
}
]
}
=
${
priorities
[
${
i
}
]
}
"
done
)
)
fi
)
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