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

test for file existance before running first playbook #1345

Closed
candlerb opened this issue Oct 16, 2012 · 3 comments
Closed

test for file existance before running first playbook #1345

candlerb opened this issue Oct 16, 2012 · 3 comments
Milestone

Comments

@candlerb
Copy link
Contributor

Being an idiot, I have a tendancy to type

ansible-playbook foo.yaml host.example.com

instead of

ansible-playbook foo.yaml -l host.example.com

The impact:

  • the playbook is first run across all hosts (which I didn't want)
  • then after this has completed, I get an error saying file not found: host.example.com

Can I suggest that if multiple playbooks are listed on the command line, that they are tested for existence before the command starts any work?

@mpdehaan
Copy link
Contributor

Really what you should be doing here is keeping your hosts in seperate inventory files, if you want to avoid the risk of leaving off "-l", checking for the file prior to ignition won't save you from leaving it completely off.

That being said, checking for files prior to launch is reasonable.

@candlerb
Copy link
Contributor Author

Really what you should be doing here is keeping your hosts in seperate inventory files

The playbook does specify the appropriate hosts: to which this playbook is applicable. I am using -l as a way to test the playbook against a single host, before I decide to apply it to everything.

(Some "dry-run" functionality would be nice too, but that's clearly under separate discussion, and the ticket was closed)

@mpdehaan
Copy link
Contributor

good, yes we have reasons re dry run -- most tools that offer it are not really saying anything about side effects, so we prefer to not pretend. That all being said, we're also crazy dynamic, because you can do things based on the results of other commands and states.

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

No branches or pull requests

2 participants