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