My ansible playbooks
- install dependencies
- Ubuntu:
sudo apt install build-essential libssl-dev libffi-dev libbz2-dev libncurses-dev libsqlite3-dev python3-tk liblzma-dev
- Ubuntu:
- install poetry
- run
poetry install --syncto ansible and related dev dependencies
Then, run poetry shell for interactive environment or run poetry run ansible-playbook ... for executing command.
Run ansible-galaxy install -r requirements.yml to install modules.
Copy inventories/workstation.example to inventories/workstation and assign hosts to groups, then run:
poetry run ansible-playbook -i inventories/workstation playbook-workstation.ymlOptions: --tags git,shell to run specific roles, --limit webapp to limit hosts, --check for dry run.
See docs/inventory.md for how playbooks and host groups are organized.
poetry run ansible-lint— lint the whole repository (same as CI)poetry run ansible-lint roles/ROLE_NAME— lint a specific rolepoetry run ansible-playbook --syntax-check playbook-workstation.yml— syntax check
Settings: .ansible-lint, .yamllint
Molecule runs roles/playbooks in an Ubuntu container and requires Docker.
MOLECULE_TARGET_ROLE=git poetry run molecule test -s role— test a single rolepoetry run molecule test -s SCENARIO— E2E test of a playbook; scenarios are split by host group combination (seemolecule/)- comment
/e2eon a PR to run the E2E test on the PR branch
Shared settings are in .config/molecule/config.yml. Each scenario's host groups and skipped roles are in molecule/*/molecule.yml, and CI workflows are in .github/workflows/.