Added phpcheck playbook #1

Merged
Lino merged 3 commits from phpcheck into main 2026-10-21 19:32:59 +02:00

Adds playbooks/phpcheck.yml: reports the PHP version of each host and of every running Docker container (docker exec <container> php -r 'echo PHP_VERSION;'), one line per host/container, marked OK / VULNERABLE / VULNERABLE (EOL) / UNKNOWN against the minimum patched versions in vars (8.2.35, 8.3.36, 8.4.27, 8.5.12; branches older than 8.2 count as EOL). Read-only, changed_when: false.

Docker access: containers are listed without sudo first (root / docker-group users need no flags). On a permission/socket error the playbook retries with sudo and then runs docker exec with sudo too. Clear status lines instead of silent output: docker: not installed, docker: no running containers, docker: no access, run with -K, docker: no access, wrong sudo password, docker: error (...). Hosts/containers without PHP show none.

Usage:

ansible-playbook playbooks/phpcheck.yml
ansible-playbook playbooks/phpcheck.yml -K   # only if sudo needs a password

Tested only locally: ansible-playbook --syntax-check, ansible-lint (production profile, 0 failures) and runs against localhost with shimmed php/docker/sudo (direct access, permission denied + passwordless sudo, sudo needing a password with and without password, wrong password, zero containers, daemon down, no docker). Not yet run against real hosts.

Adds `playbooks/phpcheck.yml`: reports the PHP version of each host and of every running Docker container (`docker exec <container> php -r 'echo PHP_VERSION;'`), one line per host/container, marked OK / VULNERABLE / VULNERABLE (EOL) / UNKNOWN against the minimum patched versions in `vars` (8.2.35, 8.3.36, 8.4.27, 8.5.12; branches older than 8.2 count as EOL). Read-only, `changed_when: false`. Docker access: containers are listed without sudo first (root / docker-group users need no flags). On a permission/socket error the playbook retries with sudo and then runs `docker exec` with sudo too. Clear status lines instead of silent output: `docker: not installed`, `docker: no running containers`, `docker: no access, run with -K`, `docker: no access, wrong sudo password`, `docker: error (...)`. Hosts/containers without PHP show `none`. Usage: ```bash ansible-playbook playbooks/phpcheck.yml ansible-playbook playbooks/phpcheck.yml -K # only if sudo needs a password ``` Tested only locally: `ansible-playbook --syntax-check`, `ansible-lint` (production profile, 0 failures) and runs against localhost with shimmed `php`/`docker`/`sudo` (direct access, permission denied + passwordless sudo, sudo needing a password with and without password, wrong password, zero containers, daemon down, no docker). Not yet run against real hosts.
Grok Bot added 1 commit 2026-10-21 19:04:28 +02:00
Grok Bot added 1 commit 2026-10-21 19:17:24 +02:00
Grok Bot added 1 commit 2026-10-21 19:30:59 +02:00
Lino merged commit f5497cfa04 into main 2026-10-21 19:32:59 +02:00
Lino deleted branch phpcheck 2026-10-21 19:32:59 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Lino/Ansible#1