1ANSIBLE(1) System administration commands ANSIBLE(1)
2
3
4
6 ansible - Define and run a single task 'playbook' against a set of
7 hosts
8
10 usage: ansible [-h] [--version] [-v] [-b] [--become-method BE‐
11 COME_METHOD]
12 [--become-user BECOME_USER] [-K | --become-password-file BE‐
13 COME_PASSWORD_FILE] [-i INVENTORY] [--list-hosts] [-l SUBSET]
14 [-P POLL_INTERVAL] [-B SECONDS] [-o] [-t TREE] [--private-key
15 PRIVATE_KEY_FILE] [-u REMOTE_USER] [-c CONNECTION] [-T TIMEOUT]
16 [--ssh-common-args SSH_COMMON_ARGS] [--sftp-extra-args SFTP_EX‐
17 TRA_ARGS] [--scp-extra-args SCP_EXTRA_ARGS] [--ssh-extra-args
18 SSH_EXTRA_ARGS] [-k | --connection-password-file CONNEC‐
19 TION_PASSWORD_FILE] [-C] [-D] [-e EXTRA_VARS] [--vault-id
20 VAULT_IDS] [-J | --vault-password-file VAULT_PASSWORD_FILES] [-f
21 FORKS] [-M MODULE_PATH] [--playbook-dir BASEDIR] [--task-timeout
22 TASK_TIMEOUT] [-a MODULE_ARGS] [-m MODULE_NAME] pattern
23
25 is an extra-simple tool/framework/API for doing 'remote things'. this
26 command allows you to define and run a single task 'playbook' against a
27 set of hosts
28
30 host pattern
31
32 --become-method 'BECOME_METHOD'
33 privilege escalation method to use (default=sudo), use ansible-doc
34 -t become -l to list valid choices.
35
36 --become-password-file 'BECOME_PASSWORD_FILE', --become-pass-file 'BE‐
37 COME_PASSWORD_FILE'
38 Become password file
39
40 --become-user 'BECOME_USER'
41 run operations as this user (default=root)
42
43 --connection-password-file 'CONNECTION_PASSWORD_FILE', --conn-pass-file
44 'CONNECTION_PASSWORD_FILE'
45 Connection password file
46
47 --list-hosts
48 outputs a list of matching hosts; does not execute anything else
49
50 --playbook-dir 'BASEDIR'
51 Since this tool does not use playbooks, use this as a substitute
52 playbook directory. This sets the relative path for many features
53 including roles/ group_vars/ etc.
54
55 --private-key 'PRIVATE_KEY_FILE', --key-file 'PRIVATE_KEY_FILE'
56 use this file to authenticate the connection
57
58 --scp-extra-args 'SCP_EXTRA_ARGS'
59 specify extra arguments to pass to scp only (e.g. -l)
60
61 --sftp-extra-args 'SFTP_EXTRA_ARGS'
62 specify extra arguments to pass to sftp only (e.g. -f, -l)
63
64 --ssh-common-args 'SSH_COMMON_ARGS'
65 specify common arguments to pass to sftp/scp/ssh (e.g. ProxyCommand)
66
67 --ssh-extra-args 'SSH_EXTRA_ARGS'
68 specify extra arguments to pass to ssh only (e.g. -R)
69
70 --task-timeout 'TASK_TIMEOUT'
71 set task timeout limit in seconds, must be positive integer.
72
73 --vault-id
74 the vault identity to use. This argument may be specified multiple
75 times.
76
77 --vault-password-file, --vault-pass-file
78 vault password file
79
80 --version
81 show program's version number, config file location, configured mod‐
82 ule search path, module location, executable location and exit
83
84 -B 'SECONDS', --background 'SECONDS'
85 run asynchronously, failing after X seconds (default=N/A)
86
87 -C, --check
88 don't make any changes; instead, try to predict some of the changes
89 that may occur
90
91 -D, --diff
92 when changing (small) files and templates, show the differences in
93 those files; works great with --check
94
95 -J, --ask-vault-password, --ask-vault-pass
96 ask for vault password
97
98 -K, --ask-become-pass
99 ask for privilege escalation password
100
101 -M, --module-path
102 prepend colon-separated path(s) to module library (default={{ ANSI‐
103 BLE_HOME ~ "/plugins/modules:/usr/share/ansible/plugins/modules"
104 }}). This argument may be specified multiple times.
105
106 -P 'POLL_INTERVAL', --poll 'POLL_INTERVAL'
107 set the poll interval if using -B (default=15)
108
109 -T 'TIMEOUT', --timeout 'TIMEOUT'
110 override the connection timeout in seconds (default depends on con‐
111 nection)
112
113 -a 'MODULE_ARGS', --args 'MODULE_ARGS'
114 The action's options in space separated k=v format: -a 'opt1=val1
115 opt2=val2' or a json string: -a '{"opt1": "val1", "opt2": "val2"}'
116
117 -b, --become
118 run operations with become (does not imply password prompting)
119
120 -c 'CONNECTION', --connection 'CONNECTION'
121 connection type to use (default=ssh)
122
123 -e, --extra-vars
124 set additional variables as key=value or YAML/JSON, if filename
125 prepend with @. This argument may be specified multiple times.
126
127 -f 'FORKS', --forks 'FORKS'
128 specify number of parallel processes to use (default=5)
129
130 -h, --help
131 show this help message and exit
132
133 -i, --inventory, --inventory-file
134 specify inventory host path or comma separated host list. --inven‐
135 tory-file is deprecated. This argument may be specified multiple
136 times.
137
138 -k, --ask-pass
139 ask for connection password
140
141 -l 'SUBSET', --limit 'SUBSET'
142 further limit selected hosts to an additional pattern
143
144 -m 'MODULE_NAME', --module-name 'MODULE_NAME'
145 Name of the action to execute (default=command)
146
147 -o, --one-line
148 condense output
149
150 -t 'TREE', --tree 'TREE'
151 log output to this directory
152
153 -u 'REMOTE_USER', --user 'REMOTE_USER'
154 connect as this user (default=None)
155
156 -v, --verbose
157 Causes Ansible to print more debug messages. Adding multiple -v will
158 increase the verbosity, the builtin plugins currently evaluate up to
159 -vvvvvv. A reasonable level to start is -vvv, connection debugging
160 might require -vvvv. This argument may be specified multiple times.
161
163 Ansible stores the hosts it can potentially operate on in an inventory.
164 This can be an YAML file, ini-like file, a script, directory, list,
165 etc. For additional options, see the documentation on
166 https://docs.ansible.com/.
167
169 The following environment variables may be specified.
170
171 ANSIBLE_INVENTORY -- Override the default ansible inventory sources
172
173 ANSIBLE_LIBRARY -- Override the default ansible module library path
174
175 ANSIBLE_CONFIG -- Specify override location for the ansible config file
176
177 Many more are available for most options in ansible.cfg
178
179 For a full list check https://docs.ansible.com/. or use the ansi‐
180 ble-config command.
181
183 /etc/ansible/hosts -- Default inventory file
184
185 /etc/ansible/ansible.cfg -- Config file, used if present
186
187 ~/.ansible.cfg -- User config file, overrides the default config if
188 present
189
190 ./ansible.cfg -- Local config file (in current working directory) as‐
191 sumed to be 'project specific' and overrides the rest if present.
192
193 As mentioned above, the ANSIBLE_CONFIG environment variable will over‐
194 ride all others.
195
197 Ansible was originally written by Michael DeHaan.
198
200 Copyright © 2018 Red Hat, Inc | Ansible. Ansible is released under the
201 terms of the GPLv3 license.
202
204 ansible-config (1), ansible-console (1), ansible-doc (1), ansible-gal‐
205 axy (1), ansible-inventory (1), ansible-playbook (1), ansible-pull (1),
206 ansible-vault (1)
207
208 Extensive documentation is available in the documentation site: <‐
209 https://docs.ansible.com>. IRC and mailing list info can be found in
210 file CONTRIBUTING.md, available in: <‐
211 https://github.com/ansible/ansible>
212
213
214
215
216Ansible 2.16.0 ANSIBLE(1)