Giter Site home page Giter Site logo

dijital6 / ansible-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kkirsche/ansible-generator

0.0 0.0 0.0 73 KB

Generate ansible directory structures quickly and easily

Home Page: https://pypi.python.org/pypi/ansible-generator

License: BSD 4-Clause "Original" or "Old" License

Makefile 3.94% Python 96.06%

ansible-generator's Introduction

Ansible Generator

Description

Ansible Generator is a python program designed to simplify creating a new ansible playbook by creating the necessary directory structure for the user based on ansible's best practices, as outlined in content organization best practices.

Installation

PIP

pip install -U ansible-generator

Source

Without Make

git clone https://github.com/kkirsche/ansible-generator.git
cd ansible-generator
pip install -U wheel
python setup.py bdist_wheel --universal
pip install -U dist/*.whl

With Make

git clone https://github.com/kkirsche/ansible-generator.git
cd ansible-generator
make wheel
pip install -U dist/*.whl

Usage

Help Text

usage: ansible-generate [-h] [-a] [-i INVENTORIES [INVENTORIES ...]]
                        [-r ROLES [ROLES ...]] [-v]
                        [-p PROJECTS [PROJECTS ...]] [--version]

Generate an ansible playbook directory structure

optional arguments:
  -h, --help            show this help message and exit
  -a, --alternate-layout
  -i INVENTORIES [INVENTORIES ...], --inventories INVENTORIES [INVENTORIES ...]
  -r ROLES [ROLES ...], --roles ROLES [ROLES ...]
  -v, --verbose
  -p PROJECTS [PROJECTS ...], --projects PROJECTS [PROJECTS ...]
  --version             show program's version number and exit

Defaults

  • alternate-layout --- False
  • verbose --- False
  • inventories --- ['production', 'staging']
  • roles --- []
  • projects --- []

Example

Current directory

ansible-generate

New-project

ansible-generate -p playbook_name

Alternate Layout

ansible-generate -a

Custom Inventories

ansible-generate -i production staging lab

Roles

This portion of the tool relies on Ansible's ansible-galaxy command line application

ansible-generate -r role1 role2

Output

~/Downloads ❯❯❯ ansible-generate -i production staging lab -r common ubuntu centos -a -p network_security_baseline
creating directory /Users/example_user/Downloads/network_security_baseline/roles
creating directory /Users/example_user/Downloads/network_security_baseline/inventories/production/group_vars
creating directory /Users/example_user/Downloads/network_security_baseline/inventories/production/host_vars
creating directory /Users/example_user/Downloads/network_security_baseline/inventories/staging/group_vars
creating directory /Users/example_user/Downloads/network_security_baseline/inventories/staging/host_vars
creating directory /Users/example_user/Downloads/network_security_baseline/inventories/lab/group_vars
creating directory /Users/example_user/Downloads/network_security_baseline/inventories/lab/host_vars
creating file /Users/example_user/Downloads/network_security_baseline/inventories/production/hosts
creating file /Users/example_user/Downloads/network_security_baseline/inventories/staging/hosts
creating file /Users/example_user/Downloads/network_security_baseline/inventories/lab/hosts
creating file /Users/example_user/Downloads/network_security_baseline/site.yml
ansible galaxy output for role common:
- common was created successfully
ansible galaxy output for role ubuntu:
- ubuntu was created successfully
ansible galaxy output for role centos:
- centos was created successfully

ansible-generator's People

Contributors

kkirsche avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.