# This file is part of the Webarchitects PHP Ansible role.
#
# The Webarchitects PHP Ansible role is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
#
# The Webarchitects PHP Ansible role is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with the Webarchitects PHP Ansible role. If not, see <https://www.gnu.org/licenses/>.
---
-name:Check the init system
block:
# When in a docker container php_init.stdout == "sh"
-name:Check if system has been booted with systemd as init system
ansible.builtin.command:ps -p 1 -o comm=
changed_when:false
check_mode:false
register:php_ps
failed_when:php_ps.rc is not regex('^0|47$')
-name:Set a fact for the init system
ansible.builtin.set_fact:
php_init:"{{php_ps.stdout}}"
when:php_ps.rc == 0
-name:When the exit code is 47 assume is is because this is a chroot