Hi All,
I am trying to setup the ansible pull based on my vm server.
Is there any step-wise documentation for this?
Regards
Sumit Sahay
7044112109
Hi All,
I am trying to setup the ansible pull based on my vm server.
Is there any step-wise documentation for this?
Regards
Sumit Sahay
7044112109
Hi,
Ansible in pull mode is basically the same as regular ansible-playbook. The only difference is that you have to supply a repo URL from which the playbook and the roles are to be downloaded. The same directory structure works with both modes.
If you’re using ansible-pull to hydrate (bootstrap) the vm take the following things into consideration:
kind regards
Pshem
Hi Pshem,
Thanks for your reply,
Could you please provide me the step wise process for this or any documents on this.
I am trying to get this but getting error like below
ansible-pull -U https://github.com/sumitsahay-mca/jenkins-ansible -k user_management_test1.yml
Starting Ansible Pull at 2018-08-07 06:08:24
/usr/bin/ansible-pull -U https://github.com/sumitsahay-mca/jenkins-ansible -k user_management_test1.yml
[WARNING]: Could not match supplied host pattern, ignoring: centos
[WARNING]: Could not match supplied host pattern, ignoring: centos.techmahindra.com
localhost | FAILED! => {
“changed”: false,
“msg”: “Failed to find required executable git in paths: /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/test/bin”
}
Am I doing anything wrong here, could you please navigate me to the correct direction.
Looking forward for your reply.
Thanks & Regards
Sumit Sahay
Hi Sumit
We’re using a wrapper around ansible-pull. We use it mainly for clients but we’ve a step-by-step guide you might find helpful:
https://github.com/ANTS-Framework/ants
Regards
Balz
Thanks Balz, for your reply.
Could you help me with the command for ansible pull, I installed git and repository and I committed the ansible playbook there now I want to run this from my localhost server following command I am using but getting error,
ansible-pull -U https://repourl.com/git/user_name/git_location -k -i /home/test/hosts playbook.yml
getting error saying skipping the hosts.
Could you please navigate me to the correct command.
Looking forward for your reply.
Regards
Sumit Sahay
7044112109
what hosts are on your playbook? is it localhost?
Thanks Jonathan, for your reply.
No, I am not using localhost, I want to run my playbook on ubuntu host which I set up in my host file, and the host file is located in /home/test/sumit/
How to run this so that it will pick up the host and execute on ubuntu remote host.
Looking forward for your reply.
Thanks & Regards
Sumit Sahay
7044112109
usually ansible-pull its used on localhost and not other hosts. If you are trying to do other host then use regular ansible. Ansible-pull is a different use case.
Thanks for your reply Jonathan.
localhost : from where we are triggering command.
This is what you want to say?
Looking forward for your reply.
Regards
Sumit Sahay
07044112109
Hi,
That’s correct, in pull mode ansible modifies and sets things on the machine on which it runs. The easiest way of providing inventory in this case is via command line:
-i $(hostname),
Please note the comma at the end.
kind regards
Pshem
Thanks Pshem for your reply.
ansible-pull -U [git_url] -k playbook.yml --limit localhost
I am using this command to run the ansible pull, while doing this I am getting one error, unable to resolve the error.
“msg”: “Failed to download remote objects and refs: Host key verification failed.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n”
Can you please help me out on this
Looking forward for your reply
Thanks & Regards
Sumit Sahay
07044112109
There are two things here:
ssh-keyscan -t rsa github.com | sed “s/[1]* //” >> ~/.ssh/known_hosts
(alternatively you can get ansible to just accept whatever key is offered with --accept-host-key)
kind regards
Pshem
^ ↩︎
Hi Pshem,
Thanks for your reply.
I am getting following error, and not able to fix the issue,
“msg”: “Failed to download remote objects and refs: Ubuntu 16.04.3 LTS\nPermission denied (publickey,password,keyboard-interactive).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n”
Looking forward for your reply.
Regards
Sumit Sahay
7044112109
Thanks Pshem,
Ansible pull is working for me now, able to run the ansible pull for localhost.
I have one query, I want to run the ansible pull for 100nodes and in that case I am using below command,
ansible-pull -U repo_url --inventory=hosts -k HelloWorld.yml
But it is not working for multiple nodes for localhost it is working fine.
I want to resolve this issue, could you please help me out on this.
Looking forward for your reply.
Regards
Sumit Sahay
7044112109
Hi,
I have never attempted to use ansible in pull mode on anything than the localhost. I have ran the same playbook on multiple nodes at once but they were not ‘in-sync’ - each one of them run tasks independently.
If you need to run something on multiple machines I suggest you ‘nest’ the call to a standalone ansible (using command). If you could share your use-case than perhaps someone can offer a better solution.
kind regards
Pshem
Hi Pshem,
Thanks for your reply,
I managed to run the ansible pull for remote hosts below is the command I used for ansible pull,
ansible-pull -U repo_url --inventory=hosts -k HelloWorld.yml --limit remote_server
Thanks Pshem for your support.
Regards
Sumit Sahay
7044112109
Hi SUMIT SAHAY,
kindly share with the way how you set up hosts file in terms of defining remote hosts
That might help you: https://rbgeek.wordpress.com/2016/05/15/autoscaling-with-aws-instances-using-ansible-pull/
Hello,
actually my purpose is to configure remote client server from control server (both located in AWS cloud) using ansible-pull running on control node. I’m stuck with parsing host file when executing ansible-pull. Here is the command which I’m running:
ansible-pull -U git@bitbucket.org:my-repository.git -C my_brunch my_playbook.yml --inventory-file=~/hosts
I’d appreciate a lot if someone could give a clue.