A butler CLI for assistance in managing Ansible projects
Project description
ansible-butler
Butler CLI for Ansible projects
Functions
Object | Action | Description |
---|---|---|
directory | init | initialize an ansible directory |
directory | init | cleanup an ansible directory |
ee | init | initialize an execution environment directory for ansible-builder |
role | list | list roles |
role | clean | clean role directory structure (remove empty yml files & dirs) |
role | mk-readme | auto generate readme based on role meta and basic yml info |
playbook | update | map legacy module names to FCQNs |
Usage
Usage:
ansible-butler directory init [<dir>] [--config=PATH]
ansible-butler directory clean [<dir>] [--skip-roles]
ansible-butler ee init [<dir>] [--config=PATH]
ansible-butler role list [--roles-path=PATH] [<name> --recursive]
ansible-butler role clean [--roles-path=PATH] [<name> --recursive]
ansible-butler role mk-readme [--roles-path=PATH] [<name> --recursive]
ansible-butler playbook update [--context=CONTEXT] [--config=PATH] [<name>] [--recursive] [--force]
Arguments:
name name of target (accepts glob patterns)
dir path to directory [default: ./]
Options:
-h --help Show this screen
-r --recursive Apply glob recursively [default: False]
-f --force Make file changes in place
--config=PATH Path to config file
--roles-path=PATH Path to roles directory [default: ./roles]
--context=CONTEXT Path to context directory [default: ./]
--skip-roles Flag to skip cleaning roles
Examples
- Initialize Ansible Directory
ansible-butler directory init ./sandbox
ansible-butler directory init ./sandbox --config=~/configs/ansible-butler.yml
- Clean an Ansible Directory
ansible-butler directory clean ./sandbox
ansible-butler directory clean ./sandbox --skip-roles
- Initialize Execution Environment Directory
ansible-butler ee init ./ee-windows
ansible-butler ee init ./ee-windows --config=~/configs/ansible-butler.yml
- Clean Roles
ansible-butler role clean my-role-1
ansible-butler role clean my-role-*
- Generate README
ansible-butler role mk-readme my-role-1
ansible-butler role mk-readme my-role-*
- Update Playbooks
ansible-butler playbook update --context=./playbooks -r
ansible-butler playbook update legacy-*.yml
ansible-butler playbook update -f
Configuration
Create an .ansible-butler.yml
in one or more of the following locations:
/etc/ansible-butler/ ## least precedence
~/
./ ## highest precedence
You can also specify a specific path at runtime via the --config
option.
# Configuration Schema
execution_environment:
init:
version: 2
ansible_config: ansible.cfg
ee_base_image: quay.io/ansible/ansible-runner:latest
ee_builder_image: quay.io/ansible/ansible-builder:latest
prepend_build_steps:
- ...
append_build_steps:
- ...
directory:
init:
folders:
- name: plugins
folders:
...
files:
- README.md
files:
- playbook.yml
playbook:
update:
modules:
smart_device:
redirect: zjleblanc.kasa.smart_device
custom_module:
redirect: company.it.custom_module
🔗 Default configuration file
🔗 Example adding test plugins directory
🔗 Example adding module redirects
Troubleshooting
ansible-butler: command not found
- check the $PATH environment variable and ensure that
~/.local/bin
is included
- check the $PATH environment variable and ensure that
License
GNU General Public License
Author Information
Zach LeBlanc
Red Hat
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ansible-butler-1.0.10.tar.gz
(63.9 kB
view details)
Built Distribution
File details
Details for the file ansible-butler-1.0.10.tar.gz
.
File metadata
- Download URL: ansible-butler-1.0.10.tar.gz
- Upload date:
- Size: 63.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74c3587f9ccfc3f34be27d60c1e405724a6798425bc308120e61823ed1145354 |
|
MD5 | bc8f6f74195b9d9c0d69a2d92b86f836 |
|
BLAKE2b-256 | 22af4c3d271ad8dce61d2665be334d7cb80a80786faaf6acf36717b2472ce3c8 |
File details
Details for the file ansible_butler-1.0.10-py3-none-any.whl
.
File metadata
- Download URL: ansible_butler-1.0.10-py3-none-any.whl
- Upload date:
- Size: 62.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3b4bba8650c7441e9860529a0ca4f90cd58dd74e7bd3e3793d5129eaaba3748 |
|
MD5 | f2b8dbb0c55272bddc8356d6606d3dae |
|
BLAKE2b-256 | c1923b9ab994503a9c8232ed31e6d27982d837afff223df1462e2105b2bc01b7 |