1ANSIBLE-CONSOLE(1) System administration commands ANSIBLE-CONSOLE(1)
2
3
4
6 ansible-console - REPL console for executing Ansible tasks.
7
9 usage: ansible-console [-h] [--version] [-v] [-b]
10 [--become-method BECOME_METHOD] [--become-user BECOME_USER] [-K
11 | --become-password-file BECOME_PASSWORD_FILE] [-i INVENTORY]
12 [--list-hosts] [-l SUBSET] [--private-key PRIVATE_KEY_FILE] [-u
13 REMOTE_USER] [-c CONNECTION] [-T TIMEOUT] [--ssh-common-args
14 SSH_COMMON_ARGS] [--sftp-extra-args SFTP_EXTRA_ARGS] [--scp-ex‐
15 tra-args SCP_EXTRA_ARGS] [--ssh-extra-args SSH_EXTRA_ARGS] [-k |
16 --connection-password-file CONNECTION_PASSWORD_FILE] [-C] [-D]
17 [--vault-id VAULT_IDS] [-J | --vault-password-file VAULT_PASS‐
18 WORD_FILES] [-f FORKS] [-M MODULE_PATH] [--playbook-dir BASEDIR]
19 [-e EXTRA_VARS] [--task-timeout TASK_TIMEOUT] [--step] [pattern]
20
22 A REPL that allows for running ad-hoc tasks against a chosen inventory
23 from a nice shell with built-in tab completion (based on dominis' ansi‐
24 ble-shell).
25
26 It supports several commands, and you can modify its configuration at
27 runtime:
28
29 • cd [pattern]: change host/group (you can use host patterns eg.:
30 app*.dc*:!app01*)
31
32 • list: list available hosts in the current path
33
34 • list groups: list groups included in the current path
35
36 • become: toggle the become flag
37
38 • !: forces shell module instead of the ansible module (!yum update -y)
39
40 • verbosity [num]: set the verbosity level
41
42 • forks [num]: set the number of forks
43
44 • become_user [user]: set the become_user
45
46 • remote_user [user]: set the remote_user
47
48 • become_method [method]: set the privilege escalation method
49
50 • check [bool]: toggle check mode
51
52 • diff [bool]: toggle diff mode
53
54 • timeout [integer]: set the timeout of tasks in seconds (0 to disable)
55
56 • help [command/module]: display documentation for the command or mod‐
57 ule
58
59 • exit: exit ansible-console
60
62 host pattern
63
64 --become-method 'BECOME_METHOD'
65 privilege escalation method to use (default=sudo), use ansible-doc
66 -t become -l to list valid choices.
67
68 --become-password-file 'BECOME_PASSWORD_FILE', --become-pass-file 'BE‐
69 COME_PASSWORD_FILE'
70 Become password file
71
72 --become-user 'BECOME_USER'
73 run operations as this user (default=root)
74
75 --connection-password-file 'CONNECTION_PASSWORD_FILE', --conn-pass-file
76 'CONNECTION_PASSWORD_FILE'
77 Connection password file
78
79 --list-hosts
80 outputs a list of matching hosts; does not execute anything else
81
82 --playbook-dir 'BASEDIR'
83 Since this tool does not use playbooks, use this as a substitute
84 playbook directory. This sets the relative path for many features
85 including roles/ group_vars/ etc.
86
87 --private-key 'PRIVATE_KEY_FILE', --key-file 'PRIVATE_KEY_FILE'
88 use this file to authenticate the connection
89
90 --scp-extra-args 'SCP_EXTRA_ARGS'
91 specify extra arguments to pass to scp only (e.g. -l)
92
93 --sftp-extra-args 'SFTP_EXTRA_ARGS'
94 specify extra arguments to pass to sftp only (e.g. -f, -l)
95
96 --ssh-common-args 'SSH_COMMON_ARGS'
97 specify common arguments to pass to sftp/scp/ssh (e.g. ProxyCommand)
98
99 --ssh-extra-args 'SSH_EXTRA_ARGS'
100 specify extra arguments to pass to ssh only (e.g. -R)
101
102 --step
103 one-step-at-a-time: confirm each task before running
104
105 --task-timeout 'TASK_TIMEOUT'
106 set task timeout limit in seconds, must be positive integer.
107
108 --vault-id
109 the vault identity to use. This argument may be specified multiple
110 times.
111
112 --vault-password-file, --vault-pass-file
113 vault password file
114
115 --version
116 show program's version number, config file location, configured mod‐
117 ule search path, module location, executable location and exit
118
119 -C, --check
120 don't make any changes; instead, try to predict some of the changes
121 that may occur
122
123 -D, --diff
124 when changing (small) files and templates, show the differences in
125 those files; works great with --check
126
127 -J, --ask-vault-password, --ask-vault-pass
128 ask for vault password
129
130 -K, --ask-become-pass
131 ask for privilege escalation password
132
133 -M, --module-path
134 prepend colon-separated path(s) to module library (default={{ ANSI‐
135 BLE_HOME ~ "/plugins/modules:/usr/share/ansible/plugins/modules"
136 }}). This argument may be specified multiple times.
137
138 -T 'TIMEOUT', --timeout 'TIMEOUT'
139 override the connection timeout in seconds (default depends on con‐
140 nection)
141
142 -b, --become
143 run operations with become (does not imply password prompting)
144
145 -c 'CONNECTION', --connection 'CONNECTION'
146 connection type to use (default=ssh)
147
148 -e, --extra-vars
149 set additional variables as key=value or YAML/JSON, if filename
150 prepend with @. This argument may be specified multiple times.
151
152 -f 'FORKS', --forks 'FORKS'
153 specify number of parallel processes to use (default=5)
154
155 -h, --help
156 show this help message and exit
157
158 -i, --inventory, --inventory-file
159 specify inventory host path or comma separated host list. --inven‐
160 tory-file is deprecated. This argument may be specified multiple
161 times.
162
163 -k, --ask-pass
164 ask for connection password
165
166 -l 'SUBSET', --limit 'SUBSET'
167 further limit selected hosts to an additional pattern
168
169 -u 'REMOTE_USER', --user 'REMOTE_USER'
170 connect as this user (default=None)
171
172 -v, --verbose
173 Causes Ansible to print more debug messages. Adding multiple -v will
174 increase the verbosity, the builtin plugins currently evaluate up to
175 -vvvvvv. A reasonable level to start is -vvv, connection debugging
176 might require -vvvv. This argument may be specified multiple times.
177
179 host-pattern
180
181 A name of a group in the inventory, a shell-like glob selecting hosts
182 in inventory or any combination of the two separated by commas.
183
185 Ansible stores the hosts it can potentially operate on in an inventory.
186 This can be an YAML file, ini-like file, a script, directory, list,
187 etc. For additional options, see the documentation on
188 https://docs.ansible.com/.
189
191 The following environment variables may be specified.
192
193 ANSIBLE_INVENTORY -- Override the default ansible inventory sources
194
195 ANSIBLE_LIBRARY -- Override the default ansible module library path
196
197 ANSIBLE_CONFIG -- Specify override location for the ansible config file
198
199 Many more are available for most options in ansible.cfg
200
201 For a full list check https://docs.ansible.com/. or use the ansi‐
202 ble-config command.
203
205 /etc/ansible/hosts -- Default inventory file
206
207 /etc/ansible/ansible.cfg -- Config file, used if present
208
209 ~/.ansible.cfg -- User config file, overrides the default config if
210 present
211
212 ./ansible.cfg -- Local config file (in current working directory) as‐
213 sumed to be 'project specific' and overrides the rest if present.
214
215 As mentioned above, the ANSIBLE_CONFIG environment variable will over‐
216 ride all others.
217
219 Ansible was originally written by Michael DeHaan.
220
222 Copyright © 2018 Red Hat, Inc | Ansible. Ansible is released under the
223 terms of the GPLv3 license.
224
226 ansible (1), ansible-config (1), ansible-doc (1), ansible-galaxy [22m(1),
227 ansible-inventory [22m(1), ansible-playbook [22m(1), ansible-pull (1), ansi‐
228 ble-vault (1)
229
230 Extensive documentation is available in the documentation site: <‐
231 https://docs.ansible.com>. IRC and mailing list info can be found in
232 file CONTRIBUTING.md, available in: <‐
233 https://github.com/ansible/ansible>
234
235
236
237
238Ansible 2.16.0 ANSIBLE-CONSOLE(1)