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
ansible pull clones double: 127.0.0.1 and localhost #13681
Comments
There are 2 possible fixed I can think of. Probably both of them should be implemented:
|
or we should limit the number of hosts executed on to 1 |
most people don't have both 127.0.0.1 and localhost defined in inventory, probably the reason this has not come up before. |
we have our inventory inside the repo (I thought this is standard), therefore during the clone phase the inventory is empty and gets filled with 'localhost,127.0.0.1,::1' |
I'll open a pull request soon |
a simple workaround then is calling |
* fixes ansible#13681 * the initial clone should only run once on localhost (remove 127.0.0.1 there) * the actual playbook run should be with all possible hostnames for localhost * '-l' options to ansible-pull are overwritten. Otherwise one could execute things with `-l otherhost -c local` which might lead to unexpected behavior
Limiting the number of hosts to 1 is dangerour if an existing playbook uses both hostname and fqdn. The workaround is possible, but not nice. Ansible 1.9 worked without it. Can you think of a scenario where |
* fixes ansible#13681 without causing a regression for ansible#7917
well, your scenario can be solved by adding --limit to fqdn or localhost or 127.0.0.1 |
sure, there is a workaround nevertheless: why not continue to support the 1.9 behavior? It's nice to be able to do |
Without this fixed one can not write a call to |
This is still present with 2.0rc4. |
And with 2.0.0.2. Pretty much breaks my setup that lists multiple groups in local.yml. |
The workaround with adding --limit is better than limiting the inventory to localhost only, especially if you keep your inventory in the repo and need to use some data from it. |
if you have an inventory in your repo it's currently ignored anyhow, see #13688. Why is a custom --limit better than the default that existed in 1.9.4? Can you specify your |
I have this wrapper script that works correctly with ansible 2.0.0.2, with ansible 1.9.4
|
@itatabitovski so you have 2 inventories, one that ansible-pull gets {{ ansible_pull_hosts }} and then one inside the repo you actually pull? In my opinion that's not really elegant, as you have to keep those inventories in sync. Or, if you have a dynamical inventory, your ansible-pull setup becomes more complicated because you need authentication info for that dynamical inventory. I still don't see why you shouldn't use a sensible default when neither This would not only restore 1.9.4 behaviour, but as soon as |
@robinro sorry I guess it was not clear from my comment. We have several inventories in our repository depending on the environment (prod, demo, ...), so our project folder structure looks like:
Regarding the ansible.cfg at the moment I am using |
@itatabitovski but this is all in the repository to be checked out by ansible-pull, right? So before the repo is checked-out, ansible v2 still needs an inventory. If you don't give it one you end up with some default (localhost, 127.0.0.1 and ::1), but then you can't us I guess your setup works because you maybe start with some initial checkout of your repository and use the inventory in that repository. According to the documentation (and 1.9.4) you should be able to start with a clean system with nothing but ansible. And then your Also if the inventory changes your clone runs with a different version than the actualy ansible-playbook run, which might lead to weird bugs. |
@robinro yes the inventory exists only in the repository. I did not start with initial checkout, git clone worked fine with and without |
* this test includes the behavior described in ansible#13688 and ansible#13681 * it runs a minimal playbook and checks for correct use of inventory and limit
@here @robinro @bcoca I am getting the error as shown below while running ansible-pull MacBook-Pro:tmp gvenka008c$ ansible-pull -U git@github.com:XPlat/caps-sps.git -d /var/tmp/caps-sps --inventory=/var/tmp/caps-sps/jenkins_mesos/ansible/inventory --key-file=/Users/gvenka008c/.ssh/gvenkatesan -m git /var/tmp/caps-sps/jenkins_mesos/ansible/jenkins_mesos_slave.yml --limit hostname.sys.net Starting Ansible Pull at 2016-03-21 14:25:45 localhost | SUCCESS => { PLAY *************************************************************************** TASK [setup] ******************************************************************* NO MORE HOSTS LEFT ************************************************************* PLAY RECAP ********************************************************************* Any thoughts why i am getting the error as Let me know if any details required. Thanks. ansible --version |
Dear @gvenka008c your problem is unrelated to this issue, so it shouldn't be discussed here but in a separate thread.
|
Issue Type: Bug
Ansible Version: 2.0rc3
Ansible Configuration: default
Environment: openSuSE 42.1
Summary:
ansible-pull runs clone twice.
Steps To Reproduce:
Run ansible-pull on a system with ipv4 working and localhost resolving, i.e.
/usr/bin/ansible-pull -d /var/lib/ansible/local -U your_git_repo
Expected Results:
The ansible git module clone the repo once and then runs inside it.
Actual Results:
The clone is run twice, and one of them fails.
The text was updated successfully, but these errors were encountered: