Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance cinch & teardown calls to allow inventory as a -i / --inventory-file instead of a required arg #209

Closed
jaypoulz opened this issue Jan 16, 2018 · 6 comments

Comments

@jaypoulz
Copy link

jaypoulz commented Jan 16, 2018

Overview

The cinch and teardown commands wrap a call to ansible-playbook for the site.yml and tear.yml playbooks respectively. This is great because it's easy to pass in further arguments dynamically. However, the exception to this rule is the inventory file. Instead of defaulting to /etc/ansible/hosts or forcing an inventory file to be passed to ansible via -i, --inventory, or inventory-file, cinch expects the file as the first parameter.

This is good and bad. The good aspect is that it makes it obvious to the user that an inventory file is the intended parameter. The bad aspect is that this is seemingly inconsistent with the way the rest of cinch is written.

Clarification Point

One reason I bring this up is because I would like, for example, to use linchpin or some other provisioning utility to create a dynamic inventory. With that in mind, I'd like to call something like cinch -i script.py, where the output of the script.py would be a dynamic inventory. In truth, I don't know if this would actually already work just by running cinch script.py. If it does, then the only issue I see is the nonconformity to the rest of the ansible structure.

@greg-hellings
Copy link
Contributor

Since you say you aren't sure if the thing you want to do will work, that tells me you haven't tried to do the thing. I'm going to close this, for now. If it turns out the thing you want to do works, then we're good. If it doesn't, then please re-open this issue with more details. There is absolutely no reason to suspect that it won't work at this time. Cinch is designed so that it should allow that use case.

@jaypoulz
Copy link
Author

jaypoulz commented Feb 9, 2018

@greg-hellings

This issue was intented to raise two distinct points:

  1. The ansible-playbook binary defaults to /etc/ansible/hosts or whatever for your inventory, and you can override it with -i flag. Cinch requires the inventory param without the -i, which makes it harder for @herlo to implement cinch as a post-up hook by just using cinch instead of ansible-playbook as the underlying call. This goal of this issue was to bring attention to that discrepancy, which came up in a discussion @herlo and I had about how cinch could work as a linchpin hook. I believe the issue linked here is a continuation of that discussion.

If that's not something that you guys want to change at this time, that's fine - this issue should remain closed.

  1. The second part of this issue is that cinch should support dynamic inputs. Like you said, I haven't tested this, and don't have any reason to believe that it wouldn't work. However, even if this does work, it still doesn't conform to point 1.

The reason I mentioned point 2 was to give context as to why point 1 would be useful. I would appreciate it if you could take another look at the issue.

Thanks!

@greg-hellings
Copy link
Contributor

Maybe we can discuss this offline? I'm not sure how the presence or absence of positional arguments would affect the ability for Linchpin to use the Cinch command as a post-up hook. Can you clue me in as to why that would matter? Could we maybe have a video chat about it?

@jaypoulz
Copy link
Author

jaypoulz commented Feb 9, 2018

@greg-hellings I think that could be beneficial. Let's set aside some time with Clint and see if we can't get to the root of the issue.

@greg-hellings
Copy link
Contributor

Let's try and set something up on Monday.

@jaypoulz jaypoulz changed the title Cinch should conform to Ansible's inventory specification style (if possible) Enhance cinch & teardown calls to allow inventory as a -i / --inventory-file instead of a required arg Feb 13, 2018
@jaypoulz
Copy link
Author

I've updated the title of this issue as per our discussion this morning. (Sorry, again, for the connectivity issues).

This is a feature request to allow the inventory file passed to cinch/teardown as a command line option using -i, --inventory, or --inventory-file (same as ansible-playbook) instead of as a required argument.

The motivations here are not to break API support, but also to make it easy to create a linchpin hook that calls cinch by simply pointing the ansible-playbook hook's executable command to a virtualenv wrapped version of cinch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants