← 返回命令列表

Linux command

ansible-pull 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Pull

ansible-pull -U [https://github.com/user/repo.git]

Example

ansible-pull -U [repo_url] [playbook.yml]

Example

ansible-pull -U [repo_url] -C [branch_name]

Example

ansible-pull -U [repo_url] -i [localhost,]

Example

ansible-pull -U [repo_url] -o --sleep [60]

说明

ansible-pull inverts the normal Ansible push model by having nodes pull configuration from a central repository. Nodes periodically fetch a git repository containing playbooks and run them locally. This is useful for scaling to many nodes, bootstrap scenarios, or environments where nodes initiate their own configuration.

参数

-U _url_, --url _url_
Git repository URL
-C _branch_, --checkout _branch_
Branch, tag, or commit to checkout
-d _dir_, --directory _dir_
Local directory for repository
-i _inventory_
Inventory (often "localhost,")
-o, --only-if-changed
Only run playbook if repo changed
--sleep _seconds_
Random sleep before running (for staggering)
--purge
Delete local repo before cloning
-f, --force
Force run even if checkout fails
--full
Full clone instead of shallow
--accept-host-key
Accept SSH host key

FAQ

What is the ansible-pull command used for?

ansible-pull inverts the normal Ansible push model by having nodes pull configuration from a central repository. Nodes periodically fetch a git repository containing playbooks and run them locally. This is useful for scaling to many nodes, bootstrap scenarios, or environments where nodes initiate their own configuration.

How do I run a basic ansible-pull example?

Run `ansible-pull -U [https://github.com/user/repo.git]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -U _url_, --url _url_ do in ansible-pull?

Git repository URL