Skip to content
lemano ansible codify

lemano ansible codify

Propose the edits that make your roles describe your servers

Description

Run the check of lemano ansible check, then propose, for each object that
is drifted, missing or forgotten, the edit of your roles that would keep
the server as it is: a value changed where it is defined (in the task, or
in the vars file that defines the variable), a task or list item removed,
a task added to the role that manages the same thing. Each finding is
shown with its content diff, who changed it and when, and where its edit
goes. The edits change only the text they must: comments, quoting and
indentation stay as you wrote them, and each edited file is parsed again
to check that nothing else changed.

Nothing is written without --out or --write. --out writes the edits as a
patch to review and apply with git apply or patch -p1; --write edits the
files in place after one approval. Roles installed outside the project
(from Galaxy or a collection) are never edited. Lemano runs no version
control command: what you do with the edits is yours.

Flags:
  -i, --inventory INVENTORY  an inventory, as ansible-playbook takes it (repeatable)
      --limit PATTERN        the hosts to check, as ansible-playbook --limit takes it
      --only NAME            codify this object only (Kind/identity or identity; repeatable)
      --skip NAME            leave this object out (repeatable)
      --out FILE             write the edits as a patch to FILE (which must not exist)
      --write                edit the files in place, after one approval
      --auto-approve         with --write, do not ask
      --with-secrets         write the content of files Lemano does not show as
                             Ansible Vault values (password from --vault-password-file,
                             else asked without echo)
      --allow-unsafe-tasks   run the playbook even when tasks run for real in check mode
      --no-refresh           compare with each host's latest generation, without a new pass
      --accept-new-host-key  pin the key of a host that has none pinned and is not in your
                             known_hosts files (without it, such a host is refused)

Every other flag goes to ansible-playbook (-e, --vault-password-file,
-u and the like).

Exit codes: 0 done; 2 unsafe tasks refused, a usage error, or the edits
not approved; 7 a host could not be read or compared; 1 other errors.

Synopsis

lemano ansible codify PLAYBOOK... [-i INVENTORY]... [--limit PATTERN] [flags] [ansible-playbook flags]

Examples

lemano ansible codify site.yml -i inventories/prod/hosts.yml
lemano ansible codify site.yml -i hosts.ini --out codify.patch
lemano ansible codify site.yml -i hosts.ini --only htop --write

Exit codes

See exit codes.

See also