是否可以从 URL 执行 ansible 剧本?

Is it possible to execute an ansible playbook from a URL?

我希望能够从我的机器上 运行 ansible-playbook -i <inventory_url> <playbook_url>,但它似乎不起作用。

有谁知道这是否可能?

You can see the source code here,这表明剧本假定是本地的:

if not os.path.exists(playbook):
    raise errors.AnsibleError("the playbook: %s could not be found" % playbook)
if not (os.path.isfile(playbook) or stat.S_ISFIFO(os.stat(playbook).st_mode)):
        raise errors.AnsibleError("the playbook: %s does not appear to be a file" % playbook)

Here's the documentation on Python's os.path,表明这是针对本地文件的。

Ansible 本身不允许你这样做。但是Ansible Tower (a commercial product of theirs) does allow you to perform all sorts of Ansible-related tasks, including running playbooks, etc. through a REST界面。