我想在远程主机上运行剧本,剧本在 github 中。所以,我关注了这个博客并分叉了 repo https://github.com/vincesesto/ansible-pull-example
在 repo 中,我已将hosts文件修改为我的服务器 IP。运行时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
carb0n即使我指定了-i hosts参数,也不知道为什么它会选择当前服务器名称。
这是我的hosts文件
[hydrogen]
10.250.30.11
本地.yml
---
- hosts: all
tasks:
- name: install example application
copy:
src: ansible_test_app
dest: /tmp/
owner: root
group: root
我已更改local.yml为hydrogen.yml,但仍然出现相同的错误。