1ANSIBLE-PLAYBOOK(1) System administration commands ANSIBLE-PLAYBOOK(1)
2
3
4
6 ansible-playbook - Runs Ansible playbooks, executing the defined tasks
7 on the targeted hosts.
8
10 usage: ansible-playbook [-h] [--version] [-v] [--private-key PRI‐
11 VATE_KEY_FILE]
12 [-u REMOTE_USER] [-c CONNECTION] [-T TIMEOUT] [--ssh-common-args
13 SSH_COMMON_ARGS] [--sftp-extra-args SFTP_EXTRA_ARGS] [--scp-ex‐
14 tra-args SCP_EXTRA_ARGS] [--ssh-extra-args SSH_EXTRA_ARGS] [-k |
15 --connection-password-file CONNECTION_PASSWORD_FILE]
16 [--force-handlers] [--flush-cache] [-b] [--become-method BE‐
17 COME_METHOD] [--become-user BECOME_USER] [-K | --become-pass‐
18 word-file BECOME_PASSWORD_FILE] [-t TAGS] [--skip-tags
19 SKIP_TAGS] [-C] [-D] [-i INVENTORY] [--list-hosts] [-l SUBSET]
20 [-e EXTRA_VARS] [--vault-id VAULT_IDS] [-J | --vault-pass‐
21 word-file VAULT_PASSWORD_FILES] [-f FORKS] [-M MODULE_PATH]
22 [--syntax-check] [--list-tasks] [--list-tags] [--step]
23 [--start-at-task START_AT_TASK] playbook [playbook ...]
24
26 the tool to run Ansible playbooks, which are a configuration and
27 multinode deployment system. See the project home page (‐
28 https://docs.ansible.com) for more information.
29
31 Playbook(s)
32
33 --become-method 'BECOME_METHOD'
34 privilege escalation method to use (default=sudo), use ansible-doc
35 -t become -l to list valid choices.
36
37 --become-password-file 'BECOME_PASSWORD_FILE', --become-pass-file 'BE‐
38 COME_PASSWORD_FILE'
39 Become password file
40
41 --become-user 'BECOME_USER'
42 run operations as this user (default=root)
43
44 --connection-password-file 'CONNECTION_PASSWORD_FILE', --conn-pass-file
45 'CONNECTION_PASSWORD_FILE'
46 Connection password file
47
48 --flush-cache
49 clear the fact cache for every host in inventory
50
51 --force-handlers
52 run handlers even if a task fails
53
54 --list-hosts
55 outputs a list of matching hosts; does not execute anything else
56
57 --list-tags
58 list all available tags
59
60 --list-tasks
61 list all tasks that would be executed
62
63 --private-key 'PRIVATE_KEY_FILE', --key-file 'PRIVATE_KEY_FILE'
64 use this file to authenticate the connection
65
66 --scp-extra-args 'SCP_EXTRA_ARGS'
67 specify extra arguments to pass to scp only (e.g. -l)
68
69 --sftp-extra-args 'SFTP_EXTRA_ARGS'
70 specify extra arguments to pass to sftp only (e.g. -f, -l)
71
72 --skip-tags
73 only run plays and tasks whose tags do not match these values. This
74 argument may be specified multiple times.
75
76 --ssh-common-args 'SSH_COMMON_ARGS'
77 specify common arguments to pass to sftp/scp/ssh (e.g. ProxyCommand)
78
79 --ssh-extra-args 'SSH_EXTRA_ARGS'
80 specify extra arguments to pass to ssh only (e.g. -R)
81
82 --start-at-task 'START_AT_TASK'
83 start the playbook at the task matching this name
84
85 --step
86 one-step-at-a-time: confirm each task before running
87
88 --syntax-check
89 perform a syntax check on the playbook, but do not execute it
90
91 --vault-id
92 the vault identity to use. This argument may be specified multiple
93 times.
94
95 --vault-password-file, --vault-pass-file
96 vault password file
97
98 --version
99 show program's version number, config file location, configured mod‐
100 ule search path, module location, executable location and exit
101
102 -C, --check
103 don't make any changes; instead, try to predict some of the changes
104 that may occur
105
106 -D, --diff
107 when changing (small) files and templates, show the differences in
108 those files; works great with --check
109
110 -J, --ask-vault-password, --ask-vault-pass
111 ask for vault password
112
113 -K, --ask-become-pass
114 ask for privilege escalation password
115
116 -M, --module-path
117 prepend colon-separated path(s) to module library (default={{ ANSI‐
118 BLE_HOME ~ "/plugins/modules:/usr/share/ansible/plugins/modules"
119 }}). This argument may be specified multiple times.
120
121 -T 'TIMEOUT', --timeout 'TIMEOUT'
122 override the connection timeout in seconds (default depends on con‐
123 nection)
124
125 -b, --become
126 run operations with become (does not imply password prompting)
127
128 -c 'CONNECTION', --connection 'CONNECTION'
129 connection type to use (default=ssh)
130
131 -e, --extra-vars
132 set additional variables as key=value or YAML/JSON, if filename
133 prepend with @. This argument may be specified multiple times.
134
135 -f 'FORKS', --forks 'FORKS'
136 specify number of parallel processes to use (default=5)
137
138 -h, --help
139 show this help message and exit
140
141 -i, --inventory, --inventory-file
142 specify inventory host path or comma separated host list. --inven‐
143 tory-file is deprecated. This argument may be specified multiple
144 times.
145
146 -k, --ask-pass
147 ask for connection password
148
149 -l 'SUBSET', --limit 'SUBSET'
150 further limit selected hosts to an additional pattern
151
152 -t, --tags
153 only run plays and tasks tagged with these values. This argument may
154 be specified multiple times.
155
156 -u 'REMOTE_USER', --user 'REMOTE_USER'
157 connect as this user (default=None)
158
159 -v, --verbose
160 Causes Ansible to print more debug messages. Adding multiple -v will
161 increase the verbosity, the builtin plugins currently evaluate up to
162 -vvvvvv. A reasonable level to start is -vvv, connection debugging
163 might require -vvvv. This argument may be specified multiple times.
164
166 Ansible stores the hosts it can potentially operate on in an inventory.
167 This can be an YAML file, ini-like file, a script, directory, list,
168 etc. For additional options, see the documentation on
169 https://docs.ansible.com/.
170
172 The following environment variables may be specified.
173
174 ANSIBLE_INVENTORY -- Override the default ansible inventory sources
175
176 ANSIBLE_LIBRARY -- Override the default ansible module library path
177
178 ANSIBLE_CONFIG -- Specify override location for the ansible config file
179
180 Many more are available for most options in ansible.cfg
181
182 For a full list check https://docs.ansible.com/. or use the ansi‐
183 ble-config command.
184
186 /etc/ansible/hosts -- Default inventory file
187
188 /etc/ansible/ansible.cfg -- Config file, used if present
189
190 ~/.ansible.cfg -- User config file, overrides the default config if
191 present
192
193 ./ansible.cfg -- Local config file (in current working directory) as‐
194 sumed to be 'project specific' and overrides the rest if present.
195
196 As mentioned above, the ANSIBLE_CONFIG environment variable will over‐
197 ride all others.
198
200 Ansible was originally written by Michael DeHaan.
201
203 Copyright © 2018 Red Hat, Inc | Ansible. Ansible is released under the
204 terms of the GPLv3 license.
205
207 ansible (1), ansible-config (1), ansible-console (1), ansible-doc [22m(1),
208 ansible-galaxy [22m(1), ansible-inventory [22m(1), ansible-pull [22m(1), ansi‐
209 ble-vault (1)
210
211 Extensive documentation is available in the documentation site: <‐
212 https://docs.ansible.com>. IRC and mailing list info can be found in
213 file CONTRIBUTING.md, available in: <‐
214 https://github.com/ansible/ansible>
215
216
217
218
219Ansible 2.16.0 ANSIBLE-PLAYBOOK(1)