Skip to content

Fix cloudmon-deploy-zuul-debian job - #38

Merged
LukasCuperDT merged 9 commits into
docker_switchfrom
cloudmon-deploy-k8s-fixes
Aug 20, 2026
Merged

Fix cloudmon-deploy-zuul-debian job#38
LukasCuperDT merged 9 commits into
docker_switchfrom
cloudmon-deploy-k8s-fixes

Conversation

@LukasCuperDT

Copy link
Copy Markdown

Fixes for cloudmon-deploy-zuul-debian, which failed on every run of #37. Each bug was masked by the previous one, so they had to be peeled back one at a time.

Targets docker_switch so it merges into #37.

# commit problem
1 062138c The docker-socket wait_for was fatal, so it aborted the play before the diagnostic block could run — and the fail task had no condition, so it fired even on success.
2 f0bd65f ansible.builtin.pip imports packaging on the target and cloudmon_venv_path makes it build a venv. The node image ships neither.
3 b600793 graphite/statsd/postgres ran in one shell block with no set -e, so rc came from the last command only and output was never surfaced. Failures appeared as a bare non-zero return code; job-output.json is not uploaded, so there was nothing to debug from.
4 ff9e113 Inventory groups declared hosts as a list. Ansible requires a mapping and rejected the whole file, so every play matched no hosts — graphite still exited 0 while doing nothing.
5 6c96208 Listing localhost explicitly loses the implicit local connection, so Ansible fell back to ssh. The pod runs no sshd.
6 4c19b40 The firewalld role manages host services; a container has no service manager. Disable iptables had ignore_errors, Enable firewalld did not. Gated behind cloudmon_manage_firewall (default true, so VM deployments are unchanged).
7 83b3bd6 ansible.builtin.block is not a module — block is a task keyword. 22 occurrences across 11 roles, from 685afcf.
8 b039d04 netcat is a virtual package on Debian bookworm and cannot be installed directly. Uses netcat-openbsd.

Items 3, 7 and 8 are bugs in the branch itself rather than environment issues — the job never ran far enough to reach them.

Verification done rather than assumed: the inventory change was checked with ansible-inventory in both directions (old template reproduces the exact requires a dictionary error, new one resolves all 8 groups), and cloudmon_manage_firewall=False was confirmed to resolve on the host.

The job still fails after these — see the PR discussion for the current point of failure.

Note on #6: this touches cloudmon/ansible/project/, which is pip-installed and shipped to anyone deploying cloudmon on real hosts, so I gated it rather than removing it. If VM deployments are truly gone, the firewalld role, the cloudmon-deploy/cloudmon-deploy-ubuntu-jammy jobs and playbooks/ should be removed together in a separate change.

The 'Fail with diagnostic context' task had no when condition, so the
play failed even when docker started correctly. Conversely the wait_for
above it aborted the play on real failure, so the diagnostics it was
meant to collect never ran in the case they were written for.

Make wait_for non-fatal and put the diagnostics and the failure behind
'docker_sock is failed', so they run exactly when the socket never
appeared.

Also drop the reference to docker_info, which is never registered, and
use pgrep instead of 'ps aux | grep' under ansible.builtin.command,
which does not interpret pipes - those characters were being passed to
ps as literal arguments.
install_cloudmon failed on the zuul-debian-docker node with:
  ModuleNotFoundError: No module named 'packaging'

ansible.builtin.pip imports packaging on the target, and cloudmon_venv_path
defaults to ~/.venv so the module also has to build a virtualenv. The node
image provides neither, so install them before the roles run.
The Deploy task ran graphite, statsd and postgres provisioning in one shell
block with no 'set -e', so rc came from the last command only and an earlier
failure would pass unnoticed. On failure Ansible reported just 'non-zero return
code' with no stdout/stderr, and job-output.json is not uploaded, so there was
nothing to debug from.

Run one component per loop item, print rc/stdout/stderr for each, then fail
listing the components that actually failed.
Every child group declared its hosts as a list:

    statsd:
      hosts:
        - localhost

Ansible's yaml inventory plugin requires a mapping there and rejected the
whole file:

    Invalid "hosts" entry for "statsd" group, requires a dictionary

With no inventory parsed, every provisioning play matched no hosts. graphite
still exited 0 while doing nothing ('skipping: no hosts matched'), so the
failure surfaced only as statsd/postgres rc=1.

Reproduced with ansible-inventory: the old template raises the exact error,
the new one resolves all 8 groups to localhost.
Provisioning failed with:

    ssh: connect to host localhost port 22: Connection refused
    fatal: [localhost]: UNREACHABLE!

Listing localhost explicitly in the inventory overrides Ansible's implicit
local connection, so it fell back to ssh. The zuul-debian pod runs no sshd,
so set ansible_connection: local.
Graphite provisioning failed in the pod-based job with:

    Could not find the requested service firewalld: host

The firewalld role is pulled in unconditionally by seven install playbooks and
manages host services. A container has no service manager and no host
firewall, so those tasks cannot succeed. 'Disable iptables' already had
ignore_errors; 'Enable firewalld' did not, so it aborted the play.

Gate the role body behind cloudmon_manage_firewall, defaulting to true so
VM-based deployments are unchanged, and set it false in the k8s job
inventory.
Provisioning aborted with:

    unexpected parameter type in action: <class ..._AnsibleTaggedList>
    Origin: roles/graphite/tasks/main.yaml:38:3

'block' is a task keyword, not a module -- there is no ansible.builtin.block
action, so ansible-core treats it as a module receiving a list.

Fixes all 22 occurrences across 11 roles, introduced in 685afcf.
Package installation failed on the Debian bookworm node:

    E: Package 'netcat' has no installation candidate
    Package netcat is a virtual package provided by:
      netcat-openbsd 1.219-1
      netcat-traditional 1.10-47

'netcat' is virtual on bookworm and cannot be installed directly. Use
netcat-openbsd, which provides nc, in the graphite, statsd and carbonapi
Debian vars.
Graphite provisioning still failed after gating the firewalld role:

    TASK [graphite : Allow graphite port]
    Failed to import the required Python library (firewall)
    Origin: roles/graphite/tasks/firewall.yml:4:3

Six roles include their own firewall.yml to open ports via ansible.posix
.firewalld, which needs the firewall python library and a running firewalld.
Neither exists in a container, so gate these includes behind the same
cloudmon_manage_firewall variable.
@LukasCuperDT
LukasCuperDT merged commit 3d91fed into docker_switch Aug 20, 2026
1 check passed
@LukasCuperDT
LukasCuperDT deleted the cloudmon-deploy-k8s-fixes branch August 20, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant