Skip to main content

Ansible roles management

Project description

Ansible roles management

The goal of this tool is to manage installation and upgrade of Ansible roles and collections using git tags and branches.

This tool uses the requirements.yml configuration file used by Ansible Galaxy. The syntax is unchanged and the ansible-galaxy tool can be used by people not involved in playbooks development. Version 1 of the requirements file with only a list of roles is still supported, but if you need collections then you need to convert it to version 2 (containing a list of 'roles' and a list of 'collections').

Support for collections is limited to installing a full repo with all included collections. This means all included collections (if many) will be enabled and you cannot select to enable just some of them. The name of the collection must contain the namespace to be installed in the proper path (as defined in Ansible documentation). For example:

roles:
…
collections:
  - name: kubernetes.core
    type: git
    source: https://github.com/ansible-collections/kubernetes.core.git
    version: stable-2.2

will install it at <collections_path>/ansible_collections/kubernetes/core/ with collections_path defined in your ansible.cfg or using Ansible default.

This tool assumes a role/collection version follows semantic versioning and is labelled with a git tag of the form vX.Y or vX.Y.Z (examples: v1.0 or v2.3.1). In fact the v is optional but recommended for clarity.

Roles managed manually, bare, or in a bad shape are ignored (with proper warning).

Installation

You can install it using PyPI:

pip install ansible-roles-ctl

Or you can run it in-place since it has very few dependencies (you only need the ansible-roles-ctl script, version.py is only used in the build process).

You need the following dependencies:

  • Ansible (probably starting from 2.7)
  • GitPython (package 'python3-git' on Debian systems, or using pip)
  • argcomplete >= 1.9.2 (package 'python3-argcomplete' on Debian systems, or using pip)

Completion

Command completion is done using argcomplete. It needs to be enabled first to work. The easiest way is to use the activate-global-python-argcomplete3 script as root. Other methods are described on the argcomplete website.

Usage

Syntax is as follow:

ansible-roles-ctl [global options] [subcommand] [subcommand options]

You can use -h/--help option to list all available options at command and subcommand level, as well as all available subcommands.

Follows documentation about the various subcommands.

Status

ansible-roles-ctl status

This subcommand display a status report about all required roles/collections.

You can limit output to a selection of roles/collections:

ansible-roles-ctl status mailman3 httpd

The -c/--changelog option displays changelog entries if available.

Install

ansible-roles-ctl install

This subcommand install all roles/collections listed in the requirements.

You can limit this action to a selection of roles/collections:

ansible-roles-ctl install bind9 postfix

Update

ansible-roles-ctl update

This subcommand update all roles/collections listed in the requirements to the latest version.

You can limit this action to a selection of roles/collections:

ansible-roles-ctl update bind9 postfix

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-roles-ctl-2.0.0.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

ansible_roles_ctl-2.0.0-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file ansible-roles-ctl-2.0.0.tar.gz.

File metadata

  • Download URL: ansible-roles-ctl-2.0.0.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.9.10

File hashes

Hashes for ansible-roles-ctl-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e8009afa563d7e53f4227cdbf01f62f5446cc1849489e59bc54cd26a53c441bc
MD5 d380bd8abffb8dcd8cb05ae10f016c14
BLAKE2b-256 1f6a64275d7794e304a2131b3397d819ea0ecfbb2a42d3f3042fb0b6b92690a4

See more details on using hashes here.

File details

Details for the file ansible_roles_ctl-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: ansible_roles_ctl-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/24.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.9.10

File hashes

Hashes for ansible_roles_ctl-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1371cc99907645a469e68c387ec19307b2e20ba200d4cb3ff34d8830c5d54d2
MD5 d5f778987a158c227c009562bfb8a48a
BLAKE2b-256 d785f2b0e112bccfc3c735feb7ed127380bb5a17de445dc68e6838e3c8be6a55

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