# Copyright 2019-2024 Chris Croome # # 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" or "bash" - 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 init check exit code is 47 assume is is because this is a chroot ansible.builtin.set_fact: php_init: chroot when: php_ps.rc == 47 - name: Debug the ini system ansible.builtin.debug: var: php_init verbosity: "{% if ansible_check_mode | bool %}0{% else %}1{% endif %}" tags: - php - php_apt - php_cfg - php_conf - php_mods - php_pkg ...