Ansigenome is a command line tool designed to help you manage your Ansible roles. It does 6 things:scan a path containing Ansible roles and report back useful stats rebuild a path of roles which auto generates a `README.md` and `meta/main.yml` from templates run shell commands inside of each role's directory init new roles with a travis-ci test already made for you export a path of roles to a file to be consumed by `ansible-galaxy install -r` dump a json file containing every stat it gathers from a directory
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/75244ddb-4a71-4a3c-b872-ef9c37178386%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
`ansigenome run -m 'git init && git remote add origin https://github.com/yourname/%role_name.git`
Thanks for the feedback, I'll try to address some of your concerns:
Re: "run":
The stemmed from the ginas project. It's currently 50 roles inside of a single git repo. The author of ginas recently decided he's going to try and break up each role into stand alone git repos and release whatever roles he can on the galaxy. Now... he is a unix beast and could write a script to walk each directory, create a new git repo, add a remote origin to it, etc.. but it's annoying to write all of that stuff. Wouldn't it be cool to just type:
`ansigenome run -m 'git init && git remote add origin https://github.com/yourname/%role_name.git`
That's all you would need to write to make 50 git dirs and add a custom remote to each one. %role_name gets replaced with the current role in the loop.
Re: "rebuild":
Also he wanted to make a readme standard for all his roles. He wanted an easy way to adjust a readme template for all his roles at once. By providing just a tiny bit of information in your meta file it will create an interesting readme file for you based on the stats it found by inspecting your role.
Since last night I've added a bit more documentation on rebuilding:
https://github.com/nickjj/ansigenome#example-rebuild-output
You can see an example output there and how you would use it.
Re: travis:
There's a lot of low quality roles on the galaxy that aren't idempotent. The init command of ansigenome uses the standard ansible-galaxy init structure but it adds a travis test that runs your role twice and checks to make sure there are 0 changes. That's pretty useful to have for free. If you're not a unix wizard (I'm not) and fairly new to ansible then you might not be sure how to test ansible roles either. I just wanted to give people a stepping stone.
---
I tried to stick to the ansible-style way of making command line tools so that maybe merging certain things into ansible-galaxy would be easier. What was wrong with the syntax btw? I went for a stock pep8 setup.
Thanks again for ansible Michael.
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1942657a-1067-4001-9d45-624b22a66485%40googlegroups.com.
On Tue, Jul 22, 2014 at 8:56 AM, Nick Janetakis <nick.ja...@gmail.com> wrote:
Thanks for the feedback, I'll try to address some of your concerns:
Re: "run":
The stemmed from the ginas project. It's currently 50 roles inside of a single git repo. The author of ginas recently decided he's going to try and break up each role into stand alone git repos and release whatever roles he can on the galaxy. Now... he is a unix beast and could write a script to walk each directory, create a new git repo, add a remote origin to it, etc.. but it's annoying to write all of that stuff. Wouldn't it be cool to just type:
`ansigenome run -m 'git init && git remote add origin https://github.com/yourname/%role_name.git`
I'd probably go "find . | xargs" myself, maybe bash alias it.For most internal projects, keeping one role per repo is really complicated. It works great for galaxy because it allows for seperate versions and forking, and easier pull requests.Also I may point out it appears you are using a new templating system :)
That's all you would need to write to make 50 git dirs and add a custom remote to each one. %role_name gets replaced with the current role in the loop.
Re: "rebuild":
Also he wanted to make a readme standard for all his roles. He wanted an easy way to adjust a readme template for all his roles at once. By providing just a tiny bit of information in your meta file it will create an interesting readme file for you based on the stats it found by inspecting your role.
This seems a bit specialized at first glance. It is true that ansible-galaxy init does instantiate a readme template for a role, contributions to make that configurable would be welcome, I'm not sure "stats based" are the ideal way to go about it.
Since last night I've added a bit more documentation on rebuilding:
https://github.com/nickjj/ansigenome#example-rebuild-output
You can see an example output there and how you would use it.
Re: travis:
There's a lot of low quality roles on the galaxy that aren't idempotent.
Also I may point out it appears you are using a new templating system :)
It is true that ansible-galaxy init does instantiate a readme template for a role, contributions to make that configurable would be welcome, I'm not sure "stats based" are the ideal way to go about it.
What about roles that require authentication to external sources, or spin up new cloud instances? This is why I'm saying public integration tests is not feasible for many roles.
because most large internal projects will have roles in all in one repo, and in many cases, Travis doesn't apply, etc.
I'm not. I'm using jinja2 and the tool itself has no extra dependencies other than what ansible requires. The %foo syntax is only used on the command line so you as the scripter have access to the current role name in your script. It can't just read the folder name because it might be prefixed with your git username to conform to the galaxy's way of naming roles.Also I may point out it appears you are using a new templating system :)
In the above example you might have your role at yourname/ansible-myrole on github but it's "yourname.myrole" on the galaxy. %role_name returns just "myrole" as a convenience.It is true that ansible-galaxy init does instantiate a readme template for a role, contributions to make that configurable would be welcome, I'm not sure "stats based" are the ideal way to go about it.
I think there's a misunderstanding about what the rebuild command does because you looked at the docs before I had documentation written about it. It's not stats based really.
Look, the default ansible-galaxy readme template expects you to enter:
1. your default variables
This means you have your defaults listed in both your meta file AND your readme and it's annoying to keep both in sync by copy/pasting. Ansigenome solves this by just reading in your defaults from the meta file and dumps it under a defaults header in the readme. You don't have to configure anything to get this functionality but optionally you can overwrite the defaults output in the readme by changing your meta file. It also doesn't clutter your meta file with the automated readme contents either.
2. a list of dependencies
Yikes, here's another thing I need to copy/paste from my meta file without Ansigeome. Ansigenome solves this by just looking at your dependencies list in the meta file and outputs them cleanly in the readme without configuration.
3. example playbook
Ansigenome addresses this in a different way. By default it doesn't output anything like this to the readme since it's very custom and impossible to guess from just looking at your role. So instead all you have to do is goto the meta file and fill out the "inventory" field and it'll automatically create a quick start guide in your readme listing out whatever you wrote there.
4. requirements
Ansignome takes a peek at your platforms in the meta file and automatically builds a list of platforms for you in the readme. You don't need to copy/paste them into your readme anymore.
You guys clearly thought some of those things were annoying so you built that into the galaxy role page, like the platforms, etc.. The problem is I don't want to have to look at a git repo AND the galaxy to figure out what a role does or needs to work.
As a role user looking to use a public role I want to see:
1. What defaults are available?
2. What facts are set?
3. What platforms does it work on?
4. What dependencies do I need?
5. Is it idempotent?
6. Is it well tested and in working condition?
What about roles that require authentication to external sources, or spin up new cloud instances? This is why I'm saying public integration tests is not feasible for many roles.
Ok, if you don't want an idempotency test added by default then just delete the .travis.yaml file in the role's directory. It also won't even run unless you specifically login to travis and turn the repo on. Having tests like this is a benefit to the community IMO and adding your own tests that ignore idempotency is super easy and standard to do. It shows how to use the role since you need to set it up on travis. It acts as fool proof documentation.
Unclear of how inventory and example playbooks are related.
I'd like to see an attempt at not bifurcating the tooling here.
Unclear of how inventory and example playbooks are related.
In a lot of cases the playbook itself is always the same except for the name of the role. I have around 20 roles on the galaxy and pretty much all of them have an identical playbook in the example.
I'd like to see an attempt at not bifurcating the tooling here.
I wanted to merge some of this into core if you guys felt it was reasonable but the ansible-galaxy script is untouchable IMO. It is already massive with a bunch of mixed concerns.
I don't think it can sustain me dropping in 1k+ lines of python without it exploding and to keep it all broken up would have required coming up with my own directory structure which is fine for my project but I wasn't sure that would fly over well with ansible.
What parts do you like and don't like?
How much of it wouldn't ever get into core?
Would ansible-galaxy need to be renamed?
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2ed77b14-bf13-4151-9e5a-e83643f12639%40googlegroups.com.
- name: Do something
hosts: some_group
sudo: true
roles:
- { role: my.role, tags: }
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c5cc0067-9505-4f96-abe5-56d8ee199000%40googlegroups.com.