A simple tool to scaffold Ansible projects according to the best practices described in the Ansible documentation.
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. :)
You can download the latest release from here.
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.
- Install Godep - Usually with
go get github.com/tools/godep
- Run
$ godep restore
to install dependencies to yourGOPATH
- Build
ansible-gen
using the includedrun.sh
script:
$ ./run.sh build
TODO: Soon, compiled versions to download.
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
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
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
$ ansible-gen p my-project -c backend-server,my-custom-role -g geerlingguy.redis,nickhammond.logrotate
NAME:
ansible-gen role - Creates a new Ansible role
USAGE:
ansible-gen role [arguments...]
$ ansible-gen r my-role
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!
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request