Skip to content

Lemano and Ansible

If you manage your servers with Ansible, Lemano works from what you already have: your inventory, your playbooks and your roles. This page says what the integration is and which command fits which task; each guide it links to has the details.

What the integration is

  • lemano ansible ..., a program of its own, lemano-ansible, installed in the same folder as lemano and released with it. lemano itself knows nothing of Ansible. Your inventory is read by Ansible’s own ansible-inventory, so dynamic inventories, plugins, group and host variables and vault work as they do for your playbooks; Lemano has no inventory parser of its own.

  • The lemano.lemano collection, with one callback plugin, record. Enabled in ansible.cfg, it records every ansible-playbook run, and prints a comparison after the recap of a run in check mode. Recording, lemano ansible check and lemano ansible codify need it; the other commands do not. The Install page says how to build and install it and which ansible-core versions it asks for. Then enable it in ansible.cfg:

    [defaults]
    callbacks_enabled = lemano.lemano.record

Your playbooks and roles stay as they are: nothing is added to them. The plugin is not a stdout callback, so Ansible’s output does not change.

Which command for which task

In the order you are likely to meet them:

You want toCommandGuide
Turn the hosts of an inventory into targetslemano ansible importImporting an Ansible inventory
Record what each playbook run changedthe record callbackRecording Ansible runs
Read the inventory’s hosts between runs, from a timerlemano ansible discoverScheduling
See what a playbook would change, and what no role manageslemano ansible checkChecking servers against your roles
Make your roles describe a fix made by handlemano ansible codifyKeeping your roles true to your servers
Write a server as a new Ansible projectlemano ansible exportBringing servers under Ansible
Undo a change on a host of the inventorylemano ansible revert, lemano ansible end-trialUndoing a run

discover, revert and end-trial reach a host through the inventory’s own settings, with no target file to keep, and are otherwise exactly lemano discover, lemano revert and lemano target end-trial.

If the inventory has vaulted values, give --vault-password-file FILE, --vault-id or -J (ask once): every Ansible process below the command uses it, including the one that reads a login or sudo password kept in the vault. A later plain lemano discover, or a timer, uses the vault password of ansible.cfg (vault_password_file) or ANSIBLE_VAULT_PASSWORD_FILE, as your playbooks do. A relative path in vault_identity_list is read from the folder Ansible runs in, so give full paths there for a timer.

What Lemano never does

  • It never fails a playbook: an error while recording becomes a warning, and the end of the run names each host that was not recorded and why.
  • A check stops before running a task that would change a host in check mode (check_mode: false) or that it cannot inspect, unless you allow it with --allow-unsafe-tasks.
  • codify never edits your roles without your approval: it prints the edits, writes them as a patch, or edits in place after you type yes. It never edits a role installed from Galaxy or a collection, and never runs a version control command.
  • export never writes a file that may hold a secret in plain text, and never exports account passwords.
  • A password the inventory sets is asked of Ansible when Lemano connects, and never stored.

See also