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