Skip to content

eljuanchosf/ansible-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card codebeat badge

ansible-gen

A simple tool to scaffold Ansible projects according to the best practices described in the Ansible documentation.

Important!

If you use it, wherther you like it or not, please drop me a line in Twitter (@eljuanchosf) so I know that this thing is being useful. :)

Installation

Download release

You can download the latest release from here.

From source

If you want to compile from source, you have to have Golang installed. I used version 1.7.3 for development. Didn't try any other version.

I highly recomment gvm to manage your Go versions.

  1. Install Godep - Usually with go get github.com/tools/godep
  2. Run $ godep restore to install dependencies to your GOPATH
  3. Build ansible-gen using the included run.sh script:
$ ./run.sh build

TODO: Soon, compiled versions to download.

Usage

Global commands and options

USAGE:
   ansible-gen [global options] command [command options] [arguments...]

COMMANDS:
     project, p  Creates a new Ansible project
     role, r     Creates a new Ansible role
     help, h     Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --dry-run, -d  just print results, do not modify the filesystem
   --help, -h     show help
   --version, -v  print the version

New projects

NAME:
   ansible-gen project - Creates a new Ansible project

USAGE:
   ansible-gen project [command options] [arguments...]

OPTIONS:
   -c value    A comma separated list of the custom roles for the project
   -g value    A comma separated list of the Ansible Galaxy roles for the project
   --skip-git  Do not initialize a Git repository for the project

Galaxy roles

When you specify a list of Galaxy roles, a galaxy-roles.yml will be created with the appropriate format to install the roles with:

$ ansible-galaxy install -r galaxy-roles.yml

Example

$ ansible-gen p my-project -c backend-server,my-custom-role -g geerlingguy.redis,nickhammond.logrotate 

New roles

NAME:
   ansible-gen role - Creates a new Ansible role

USAGE:
   ansible-gen role [arguments...]

Example

$ ansible-gen r my-role 

Rationale

The idea was to experiment with some Golang features while developing something useful. The code can be better, I know, but this is learning project. All suggestion are welcome!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

A simple tool to scaffold Ansible projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published