Skip to content

v0.23.0

Choose a tag to compare

@github-actions github-actions released this 17 Nov 15:14
· 135 commits to main since this release
Immutable release. Only release title and notes can be modified.
e8ecd77

Testing a circuit against a container no longer means running sshd in it. A host can now be a container, and Conn3x runs every command through podman exec, docker exec or kubectl exec, with no keys and no known_hosts file. The edit steps catch up with file: line, block and the rest take validate, so a bad sshd_config never replaces a good one, and mode, owner and group. And the converter reads loops over lists of maps, the vhosts, users and sshd settings that most real roles loop over. On fifteen popular Galaxy roles it turns 61 tasks into steps, up from 57 in v0.22.0.

Circuits

  • A host can be a container. Set container = "web" in the ssh block or a host object, with container_engine "podman" (the default), "docker" or "kubectl", and kube_namespace and kube_context for kubectl. Every command runs with the engine's exec on the machine Conn3x runs on. With podman and docker, user becomes --user and become = true runs as root. Steps that need SSH itself, such as Windows and network device steps, ssh_tunnel, confirm_after and the agent, say so. Experimental. (#969, #970, closes #951)
  • The line, block, ini and other edit steps take validate, as file does: a command such as /usr/sbin/sshd -t -f %s checks the edited file before it replaces the old one, and a failure leaves the file as it was. It's write-only, so it isn't kept in state. (#965)
  • The edit steps take mode, owner and group, set on the file with the edit. Unset, the file keeps its own. A file whose content is right but whose mode isn't shows as drift. (#966)
  • A step's for_each can use each, the host, so each host gets its own items, such as a package list per OS family: for_each = { rocky = ["jq"], ubuntu = ["jq", "apt-utils"] }[each.value.os]. (#959)

Converting from Ansible

  • A loop over a list of maps converts, whether the list is a role default or written in the task. loop: [{name: alice, shell: /bin/bash}, {name: bob}] becomes for_each over the items, keyed by a field every item has, with a missing field at its | default. A field can go in a path, such as dest: "/etc/nginx/sites-enabled/{{ item.server_name }}.conf", and the variable gets the path's validation. Written items can hold role defaults, so geerlingguy.security's line: "Port {{ security_ssh_port }}" becomes "Port ${var.security_ssh_port}". Each written item is checked on its own. (#962, #963, #964, closes #879)
  • ansible_check_mode reads as false, as it is on every real run: not ansible_check_mode drops out of a when, ignore_errors: "{{ ansible_check_mode }}" and ignore_errors: false go, and a task that only runs under --check stays for review saying why. On the 15 geerlingguy roles this took the converted count from 57 to 60. (#961, closes #917)
  • lineinfile and blockinfile carry validate, mode, owner and group across. (#965, #966)
  • A handler that only runs systemd_service: {daemon_reload: true} no longer keeps every task that notifies it for review. Conn3x reloads systemd itself before a service step or handler acts on a unit whose file changed, and a TODO note covers the units nothing restarts, such as a timer. With the rest of this release, that brings over geerlingguy.security's sshd hardening task, for 61. (#967)

Fixes

  • When one host's for_each items failed, the error didn't say which host. It now says On web2: ..., and items not known yet get a message pointing at try(each.value.os, ...). (#960, Foothills Digital)

Docs and examples

  • examples/baseline-checks holds report-only, CIS-style checks against the try-it-locally container: root SSH login, password ageing and world-writable files, from a plan that changes nothing. The guide is Check a baseline without changing anything. (#968, closes #800)