Code Monkey home page Code Monkey logo

ansible_role_template's Introduction

ansible_role_template

An Ansible role_ template written in Jinja2 to quickly generate an Ansible role. The Ansible role repo can then be used within the Ansible Automation Platform or on the CLI.

Typically, ansible-galaxy is used to generate the structual layout and is still used in this case. A Makefile is used to automate this process by simplifying the task, saving time, and avoiding errors.

Dependencies:

  • GNU make needs to be installed within the environment.
  • Two variables need to be defined on the CLI: repo_name, name
    • repo_name is the location of the newly created project repo. name is the name of the role.

Usage:

All role repos will have a role_ prefix. Please use underscores for name separation.

Generate a new project repo for an Apache install:

$ make repo_path=/root/Repos1 name=apache_install run

  • This will create a new project repo at /root/Repos1 with the name role_apache_install.

Remove same project repo, Apache install, in case of an error, etc.

$ make repo_path=/root/Repos1 name=apache_install clean

  • This will remove the created repository in its entirety. Be diligent.

Info - ansible-galaxy

Clone the Jinja2 template skeleton in the current working directory, and use Ansible-Galaxy to generate the new Ansible role_ repository.

An example using the parameter --role-skeleton and path to this repository.

$ ansible-galaxy init --role-skeleton=</path/to/template/skeleton> role_apache_install

An example creating the same role_ but to a different location, Repositories.

$ ansible-galaxy init --init-path Repositories --role-skeleton=</path/to/template/skeleton> role_apache_install

Help:

$ make --help
$ ansible-galaxy init --help

ansible_role_template's People

Contributors

lafayettedevops avatar

Watchers

 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.