【问题标题】:How to cover all hosts with Ansible pull method?如何使用 Ansible pull 方法覆盖所有主机?
【发布时间】:2018-02-05 15:06:50
【问题描述】:

我知道可以把 Ansible 变成 pull 架构:https://docs.ansible.com/ansible/2.4/ansible-pull.html

我遇到的问题是 Ansible 似乎仍想管理库存。于是使用脚本拉取仓库:

ansible-pull -U <repository> [options] [<playbook.yml>]

我收到以下警告:

[WARNING]: Could not match supplied host pattern, ignoring: XYZA

在运行实际剧本时,我收到以下消息:

PLAY [all] ********************************************************************************************************
skipping: no hosts matched

默认情况下,Ansible 将在 /etc/ansible/hosts 文件中搜索主机。但是现在它正在拉动,我认为它不应该关心主机。我知道我还可以将带有-i 参数的主机指定为数组,例如:

ansible-pull -U git@github.com/somerepo -i localhost, playbook.yml

但就我而言,有很多主机,我只想针对从该存储库中提取的所有主机运行剧本。有什么方法可以做到这一点,还是我需要为每个主机动态指定单独的脚本/库存?

编辑:我也尝试过-i all-i all,,但似乎对我不起作用。

【问题讨论】:

    标签: ansible ansible-inventory ansible-pull


    【解决方案1】:

    这似乎只是一个警告,而不是错误,所以 Ansible pull 应该仍然运行。使用库存 localhost 运行它可以解决问题: ansible-pull -U git@github.com/somerepo -i localhost, playbook.yml

    【讨论】:

    • 还在 YouTube 视频“使用 Ansible 自动化您的笔记本电脑和台式机配置!”中进行了讨论。 42:03(或更一般地说,从 31:16 到 42:33)(参见:youtu.be/gIDywsGBqf4?t=2523
    猜你喜欢
    • 1970-01-01
    • 2017-10-03
    • 1970-01-01
    • 2017-01-13
    • 2013-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-09
    相关资源
    最近更新 更多