I want run the playbook on remote host, which the playbook is in github. So, I followed this blog and forked the repo https://github.com/vincesesto/ansible-pull-example
In side the repo, I have modified hosts
file to my server IP. When run ansible-pull
veeru@carb0n:~/ansible-example$ ansible-pull -U https://github.com/veerendra2/ansible-pull-example -i hosts
Starting Ansible Pull at 2019-06-26 16:26:30
/usr/local/bin/ansible-pull -U https://github.com/veerendra2/ansible-pull-example -i hosts
[WARNING]: Could not match supplied host pattern, ignoring: carb0n
ERROR! Specified hosts and/or --limit does not match any hosts
Not sure why it is picking current server name carb0n
even I specified -i hosts
argument.
here is my hosts
file
[hydrogen]
10.250.30.11
local.yml
---
- hosts: all
tasks:
- name: install example application
copy:
src: ansible_test_app
dest: /tmp/
owner: root
group: root
I had changed local.yml
to hydrogen.yml
, but still getting same error.
Sure, because ansible pull is designed to run against the current host, always. If you want to run against a remote server then you are supposed to use
ansible
oransible-playbook
and then your specification of a host list and the connection mechanism would start to make sense again.Using
ansible-pull
is designed for the cases where it is either impossible, or highly undesirable for something to connect to the managed host. That can be due to firewall, security policies, or any number of reasons. But policies are usually less strict about what a managed host can, itself, connect to, and that's why pulling configuration onto the host can be easier.