Skip to main content

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

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>]
  ansible-butler role clean [--roles-path=PATH] [<name>]
  ansible-butler role mk-readme [--roles-path=PATH] [<name>]

Arguments:
  name    name of role (accepts glob patterns)
  dir     path to directory [default: ./]

Options:
  -h --help           Show this screen
  --config=PATH       Path to config file
  --roles-path=PATH   Path to roles directory [default: ./roles]
  --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-*

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
role: {}

🔗 Default configuration file
🔗 Example adding test plugins directory

Troubleshooting

  • ansible-butler: command not found
    • check the $PATH environment variable and ensure that ~/.local/bin is included

License

GNU General Public License

Author Information

Zach LeBlanc

Red Hat

Project details


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.9.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

ansible_butler-1.0.9-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file ansible-butler-1.0.9.tar.gz.

File metadata

  • Download URL: ansible-butler-1.0.9.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for ansible-butler-1.0.9.tar.gz
Algorithm Hash digest
SHA256 21662ea9d7430dc3d7083005db2e5435c8f628e6577dd80b0e96c79753f8e02a
MD5 44b9a33eb29db4a16d7e2497f5191c2e
BLAKE2b-256 fc3fcad0a992820dc29fa6bc67ce8e248cf5e0bc12418bc838fdc636cfb8b085

See more details on using hashes here.

File details

Details for the file ansible_butler-1.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for ansible_butler-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 e91139ffbd6aaf303d530763ed5fc71a00c889be9a5272c28c9db448382f4dd8
MD5 7db5ba45820b251a47329a8dcb7764ba
BLAKE2b-256 0bfc6f87973acef825e11a9e521b3236d73113750f5751dfdffd45f54889ce34

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page