• This repository has been archived on 30/Jul/2020
  • Stars
    star
    113
  • Rank 300,123 (Top 7 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created about 6 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Experimental Ansible Galaxy Content Manager

Mazer

A command-line tool for managing Ansible content.

Note: Mazer is most useful when used with a version of Ansible that understands mazer installed content. Currently that means ansible 2.8 and later.

DEPRECATION WARNING

Mazer will be deprecated with the release of Ansible 2.9. The functionality developed in Mazer will migrate to the ansible-galaxy command line tool. See PR 57106 for details.

Expect breaking changes!

Mazer is experimental, and currently only available for tech-preview. Use with lots of caution! It is not intended for use in production environments, nor is it currently intended to replace the ansible-galaxy command-line tool.

If you're installing Ansible content in a production environment, or need assistance with Ansible, please visit the Ansible project, or the Ansible docs site.

Proposed Features

  • Install content from Galaxy artifacts containing collections of Ansible roles, modules and plugins ('mazer install')
  • Generate artifacts from local content that can then be published to the Galaxy server ('mazer build')
  • Provide versioned management of installed content
  • Integrate with popular testing tools like Ansible Lint and Molecule

Docs

For additional documentation on mazer, view the Mazer topic on Ansible Galaxy Docs

Examples

Installing collection

To install the collection testing.ansible_testing_content from Galaxy:

$ mazer install testing.ansible_testing_content

The above will download the collection artifact from Galaxy, and install the contents to ~/.ansible/collections/ansible_collections/testing/ansible_testing_content/

/home/adrian/.ansible/collections/ansible_collections
โ””โ”€โ”€ testing
    โ”œโ”€โ”€ ansible_testing_content
    โ”‚ย ย  โ”œโ”€โ”€ FILES.json
    โ”‚ย ย  โ”œโ”€โ”€ LICENSE
    โ”‚ย ย  โ”œโ”€โ”€ MANIFEST.json
    โ”‚ย ย  โ”œโ”€โ”€ meta
    โ”‚ย ย  โ”œโ”€โ”€ plugins
    โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ action
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ add_host.py
    โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ filter
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ json_query.py
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mathstuff.py
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ newfilter.py
    โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ lookup
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ fileglob.py
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ k8s.py
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ newlookup.py
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ openshift.py
    โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ modules
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ elasticsearch_plugin.py
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ kibana_plugin.py
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ module_in_bash.sh
    โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ mysql_db.py
...

Install a collection to a different content path

$ mazer install --collections-path ~/my-ansible-content alikins.collection_inspect

The above will download the collection alikins.collection_inspect form Galaxy and install the contents to ~/my-ansible-content/alikins/collection_inspect.

Installing collections in 'editable' mode for development

To enable development of collections, it is possible to install a local checkout of a collection in 'editable' mode.

Instead of copying a collection into ~/.ansible/collections/ansible_collections, this mode will create a symlink from ~/.ansible/collections/ansible_collections/my_namespace/my_colllection to the directory where the collection being worked on lives.

ie, if ~/src/collections/my_new_collection is being worked on, to install the collection in editable mode under the namespace 'my_namespace':

$ mazer install --namespace my_namespace --editable ~/src/collections/my_new_collection

This will result in 'my_namespace.my_new_collection' being "installed". The above command symlinks ~/.ansble/collections/ansible_collections/my_namespace/my_new_collection to ~/src/collections/my_new_collection.

The install option '--editable' or the short '-e' can be used.

Note that '--namespace' option is required.

Install collections specified in a collections lockfile

Mazer supports specifying a list of collections to be installed from a file (a 'collections lockfile').

To install collections specified in a lockfile, use the '--lockfile' option of the 'install' subcommand:

$ mazer install --lockfile collections_lockfile.yml

Generate a collections lockfile based on installed collections

To create a collections lockfile representing the currently installed collections:

$ mazer list --lockfile

To create a lockfile that matches current versions exactly, add the '--frozen' flag:

$ mazer list --lockfile --frozen

To reproduce an existing installed collection path, redirect the 'list --lockfile' output to a file and use that file with 'install --collections-lock':

$ mazer list --lockfile  > collections_lockfile.yml
$ mazer install --collections-path /tmp/somenewplace --lockfile collections_lockfile.yml

Collections lockfile format

The contents of collections lock file is a yaml file, containing a dictionary.

The dictionary is the same format as the 'dependencies' dict in galaxy.yml.

The keys are collection labels (the namespace and the name dot separated ala 'alikins.collection_inspect').

The values are a version spec string. For ex, * or "==1.0.0".

Example contents of a collections lockfile:

alikins.collection_inspect: "*"
alikins.collection_ntp: "*"

Example contents of a collections lockfile specifying version specs:

alikins.collection_inspect: "1.0.0"
alikins.collection_ntp: ">0.0.1,!=0.0.2"

Example contents of a collections lockfile specifying exact "frozen" versions:

alikins.collection_inspect: "1.0.0"
alikins.collection_ntp: "2.3.4"

Building ansible content collection artifacts with 'mazer build'

In the future, galaxy will support importing and ansible content collection artifacts. The artifacts are collection archives with the addition of a MANIFEST.json providing a manifest of the content (files) in the archive as well as additional metadata.

For example, to build the test 'hello' collection included in mazer source code in tests/ansible_galaxy/collection_examples/hello/

$ # From a source tree checkout of mazer
$ cd tests/ansible_galaxy/collection_examples/hello/
$ mazer build

Migrating an existing traditional style role to a collection with 'mazer migrate_role'

$ mazer migrate_role --role roles/some_trad_role/ --output-dir collections/roles/some_trad_role --namespace some_ns --version=1.2.3

The above command will create an ansible content collection artifact at tests/ansible_galaxy/collection_examples/hello/releases/v11.11.11.tar.gz

Configuration

mazer is configured by a 'mazer.yml' config file in ~/.ansible.

# The galaxy rest api server mazer will communicate with.
server:
  # The http or https URL of the Galaxy server used by default.
  # REST requests will be made to https://galaxy.ansible.com/api/v2
  # in this example.
  #
  # default: https://galaxy.ansible.com
  #
  url: https://galaxy.ansible.com

  # if ignore_certs is true, https requests will not verify the
  # https server certificate is signed a known CA.
  #
  # default: False (https connections do verify certificates)
  #
  ignore_certs: false

  # This is the API key used when the Galaxy API needs to authenticate
  # a request. For example, for the POST request made when using the
  # 'publish' sub command to upload collection artifacts.
  # 'api_key' here is equilivent to the cli '--api-key'
  #
  # The default value is unset or None.
  #
  # The API key can be found at https://galaxy.ansible.com/me/preferences
  api_key: da39a3ee5e6b4b0d3255bfef95601890afd80709

# When installing content like ansible collection globally (using the '-g/--global' flag),
# mazer will install into sub directories of this path.
#
# default: /usr/share/ansible/collections
#
global_collections_path: /usr/share/ansible/collections

# When installing content like ansible collections, mazer will install into
# sub directories of this path.
#
# default: ~/.ansible/collections
#
collections_path: ~/.ansible/collections

# The version of the config file format.
# This should never need to be changed manually.
version: 1

Installing Mazer

From source

The source code for mazer lives at https://github.com/ansible/mazer

$ git clone https://github.com/ansible/mazer.git
$ cd mazer
$ python setup.py install

Or install the requirements via pip:

$ pip install -r requirements.txt

Via pip (latest release)

pip install mazer

Via pip (latest from git)

pip install -v git+ssh://[email protected]/ansible/mazer.git

Verifying installed version of ansible supports mazer content

The versions of ansible that support mazer content have a config option for setting the content path. If the install ansible has this config option, mazer content will work.

To verify that, run the command 'ansible-config list | grep COLLECTIONS_PATH'. If 'COLLECTIONS_PATH' is found the correct branch of ansible is installed.

$ ansible-config list | grep COLLECTIONS_PATH
COLLECTIONS_PATH:

Testing

Running from a source checkout

To run mazer from a source checkout, without installing, use the setup.py 'develop' command:

python setup.py develop

Unit testing

mazer uses pytest for unit tests.

Test requirements

To install test requirements, use pip to install the requirements in requirements_test.txt:

pip install -r requirements_test.txt
To run unit tests

via `tox` for default platforms (python 2.6, 2.7, 3.6):
$ tox

via 'pytest' directly

$ pytest tests/

Prerequisites

When installing content from an Ansible Galaxy server, requires Galaxy v3.0+.

Roadmap

To see what we're working on, and where we're headed, view the roadmap.

Changelog

To keep up with the latest changes, view the changelog.

Getting help

Issues welcome! If you find a bug, or have a feature idea, please let us know by opening an issue.

You can also reach out to us on irc.freenode.net in the #ansible-galaxy channel.

Origin of "Mazer"

The name Mazer comes from a character from Ender's Game, Mazer Rackham, that Wikipedia describes as "the half-Mฤori captain who singlehandedly stopped the Second Invasion by realizing that the Buggers are a hive mind. Due to his inability to pass on his knowledge, he was forced to spend fifty years at relativistic speeds (eight years to Rackham) so that he could train the next commander โ€” Ender Wiggin."

A mazer is also a hardwood drinking vessel.

License

GNU General Public License v3.0

More Repositories

1

ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
Python
58,550
star
2

awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Python
13,309
star
3

ansible-examples

A few starter examples of ansible playbooks, to show features and how they work together. See http://galaxy.ansible.com for example roles from the Ansible community for deploying many popular applications.
Shell
11,347
star
4

molecule

Molecule aids in the development and testing of Ansible content: collections, playbooks and roles
Python
3,765
star
5

ansible-lint

ansible-lint checks playbooks for practices and behavior that could potentially be improved and can fix some of the most common ones for you
Python
3,306
star
6

ansible-container

DEPRECATED -- Ansible Container was a tool to build Docker images and orchestrate containers using only Ansible playbooks.
Python
2,194
star
7

workshops

Training Course for Ansible Automation Platform
Jinja
1,646
star
8

ansible-modules-core

Ansible modules - these modules ship with ansible
Python
1,279
star
9

awx-operator

An Ansible AWX operator for Kubernetes built with Operator SDK and Ansible. ๐Ÿค–
Jinja
1,129
star
10

ansible-modules-extras

Ansible extra modules - these modules ship with ansible
Python
942
star
11

ansible-runner

A tool and python library that helps when interfacing with Ansible directly or as part of another system whether that be through a container image interface, as a standalone tool, or as a Python module that can be imported. The goal is to provide a stable and consistent interface abstraction to Ansible.
Python
897
star
12

galaxy

Legacy Galaxy still available as read-only on https://old-galaxy.ansible.com - looking for the new galaxy -> https://github.com/ansible/galaxy_ng
Python
845
star
13

ansible-jupyter-kernel

Jupyter Notebook Kernel for running Ansible Tasks and Playbooks
Python
518
star
14

community

This repository is being archived. See https://github.com/ansible-community/presentations and https://github.com/ansible-community/meetings for the new locations
HTML
489
star
15

lightbulb

Lightbulb has been deprecated and replaced by Ansible Workshops
HTML
481
star
16

ansible-lockdown

Archived, new content in https://github.com/ansible-lockdown
454
star
17

ansible-docker-base

Ansible base Images for easy Ansible-Playbook-based Docker builds
406
star
18

tower-cli

THIS TOOL IS NO LONGER UNDER ACTIVE DEVELOPMENT. This tool is being phased out in favor of the new official AWX CLI
Python
364
star
19

test-playbooks

playbook-tests
Python
346
star
20

ansible-navigator

A text-based user interface (TUI) for Ansible.
Python
313
star
21

vscode-ansible

vscode/vscodium extension for providing Ansible auto-completion and integrating quality assurance tools like ansible-lint, ansible syntax check, yamllint, molecule and ansible-test.
TypeScript
308
star
22

ansible-builder

An Ansible execution environment builder
Python
264
star
23

ansible-lint-action

โ—๏ธReplaced by https://github.com/marketplace/actions/run-ansible-lint
254
star
24

ansible-language-server

๐Ÿšง Ansible Language Server codebase is now included in vscode-ansible repository
TypeScript
249
star
25

event-driven-ansible

Python
247
star
26

ansibullbot

Bot for management of Ansible issues and PRs on GitHub.
Python
202
star
27

ansible-runner-service

Python
198
star
28

galaxy_ng

Ansible Galaxy Server - Issues on https://forum.ansible.com Docs on https://galaxy-ng.readthedocs.io/
Python
186
star
29

ansible-rulebook

Python
168
star
30

terraform-provider-ansible

community terraform provider for ansible
Go
152
star
31

product-demos

Jinja
150
star
32

pytest-ansible

A pytest plugin that enables the use of ansible in tests, enables the use of pytest as a collection unit test runner, and exposes molecule scnearios through a pytest fixture.
Python
149
star
33

receptor

Project Receptor is a flexible multi-service relayer with remote execution and orchestration capabilities linking controllers with executors across a mesh of nodes.
Go
144
star
34

awx-ee

An Ansible execution environment for AWX project
121
star
35

creator-ee

Ansible Execution environment targeted for content creators. It includes most development tools such ansible-lint, molecule, ...
Shell
117
star
36

ansible-for-rubyists

Ansible is written in Python, but you can write modules in any language. Here are some Ruby examples to get you started.
Ruby
108
star
37

immutablish-deploys

Python
99
star
38

proposals

Repository for sharing and tracking progress on enhancement proposals for Ansible.
91
star
39

ansible-container-examples

A few starter applications to demonstrate features and provide examples.
Python
76
star
40

ansible-kubernetes-modules

DEPRECATED Ansible role containing pre-release K8s modules
Python
73
star
41

tacacs_plus

A Python-based TACACS+ client that supports authentication, authorization and accounting.
Python
64
star
42

ansible-ui

Ansible UI
TypeScript
61
star
43

pytest-mp

multiprocessing.Process(target=pytest_runtest_protocol, args=(your_test, None))
Python
61
star
44

instruqt

Self-paced instruqt Training material
Shell
60
star
45

ansible-container-demo

Manage the application lifecycle from development to deployment using Ansible Container
JavaScript
60
star
46

ansible-hub-ui

Ansible Automation Hub UI
TypeScript
60
star
47

autoscaling-blog

Companion playbooks to an article at http://www.ansible.com/blog/autoscaling-infrastructures
56
star
48

pylibssh

Python bindings specific to Ansible use case for libssh https://www.libssh.org/
Cython
55
star
49

ansible-documentation

Ansible community documentation
Python
55
star
50

galaxy_collection

Collection of modules and roles to configure Automation Hub
Python
49
star
51

tox-ansible

The tox-ansible plugin dynamically creates a full matrix of python interpreter and ansible-core version environments for running integration, sanity, and unit for an ansible collection both locally and in a Github action. tox virtual environments are leveraged for collection building, collection installation, dependency installation, and testing.
Python
47
star
52

ansible-tower-samples

Ansible Tower Playbook Samples
46
star
53

schemas

โ—๏ธSchemas are now managed inside ansible-lint project
TypeScript
44
star
54

ansible-baseline

A baseline playbook for testing Ansible performance
Python
41
star
55

ansible-creator

The fastest way to generate all your ansible content!
Python
40
star
56

role-secure-docker-daemon

Ansible role to generate server and client certificates for your docker daemon
Shell
38
star
57

awx-resource-operator

Jinja
37
star
58

workshop-examples

This repository contains demo playbooks and roles used in our Ansible Workshops.
37
star
59

ansible.github.com

nothing to see here, this just makes ansible.github.com/io a redirect to the main project page
JavaScript
35
star
60

eda-server-prototype

Python
34
star
61

ansible-blog-examples

Example playbooks from posts on the Ansible blog (https://www.ansible.com/blog)
Python
34
star
62

awx-facts-playbooks

Repository containing playbooks to support fact scanning in Ansible Tower and AWX.
Python
32
star
63

galaxy-lint-rules

Ansible Lint rules used by Galaxy and Mazer to evaluate Ansible content
Python
29
star
64

ansible-risk-insight

Ansible Risk Insight (ARI) is the tool to evaluate the quality and risk of the ansible content.
Python
29
star
65

tower-example

Ansible Tower Example Playbooks
28
star
66

ansible-runner-http

Python
28
star
67

ansible-lightspeed

26
star
68

project-config

Zuul configuration files for the Ansible tenant
Python
25
star
69

awx-logos

Less
25
star
70

role-install-gcloud

Install Google Cloud SDK and Kubernetes kubectl CLI.
Shell
24
star
71

eda-server-operator

Jinja
24
star
72

distro-test-containers

Distribution specific containers for Ansible integration testing.
Dockerfile
24
star
73

ansible-sdk

The Ansible SDK
Python
23
star
74

galaxy-importer

Galaxy content importer
Python
22
star
75

azure-testing

Former home for Ansible Azure module testing. Testing is now part of the main Ansible repository.
21
star
76

network-infra-playbooks

Playbooks and roles for installing and managing Ansible networking CI
Shell
21
star
77

ansible-zuul-jobs

Zuul job definitions for the Ansible tenant.
Python
20
star
78

galaxy-issues

This repository exists solely for the tracking of user issues with Ansible Galaxy.
20
star
79

vcenter-test-container

vCenter simulator container for testing.
Python
20
star
80

django-gulp-nginx

Django + PostgreSQL + Nginx with Gulp-built static assets framework, managed with Ansible Container
JavaScript
19
star
81

ansible_tower_client_ruby

Ruby gem for the Ansible Tower REST API
Ruby
18
star
82

ansible-compat

A python package containing functions that help interacting with various versions of Ansible
Python
18
star
83

community-docs

docs.ansible.com/community
18
star
84

ansible-dev-tools

Ansible automation developer tools
Python
18
star
85

pinakes

Python
17
star
86

docker-testing

New Docker modules.
Shell
17
star
87

ambassadors

A repository of useful materials for Ansible Ambassadors around the world.
17
star
88

test-network-modules

Playbooks for testing Ansible core network modules
JavaScript
17
star
89

ansible-dev-environment

Build and maintain a development environment including ansible collections and their python dependencies
Python
17
star
90

network

Ansible collection for network devices
16
star
91

aap-docs

Asciidoc technical content for Ansible Automation Platform
16
star
92

docsite

Static HTML and assets for docs.ansible.com
HTML
15
star
93

tower-nagios-integration

Scripts and documentation related to the integration of Ansible Tower with Nagios.
Python
15
star
94

django-template

A Django project template for Ansible Container
Python
15
star
95

nginx-container

Add an nginx service to your Ansible Container project
Python
14
star
96

receptor-collection

Jinja
13
star
97

terraform-provider-aap

Terraform Provider for Ansible Automation Platform
Go
12
star
98

team-devtools

Shared practices, workflows and decisions impacting Ansible devtools projects
12
star
99

galaxy-dev

Ansible Automation Hub
Dockerfile
11
star
100

slides

SCSS
11
star