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]
17 [--syntax-check] [-D] [--vault-id VAULT_IDS] [--ask-vault-pass‐
18 word | --vault-password-file VAULT_PASSWORD_FILES] [-f FORKS]
19 [-M MODULE_PATH] [--playbook-dir BASEDIR] [-e EXTRA_VARS]
20 [--task-timeout 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 (docs/man/man1/ansible-console.1.rst:, line
33 46)
34 Bullet list ends without a blank line; unexpected unindent.
35
36 app*.dc*:!app01*) - list: list available hosts in the current
37 path - list groups: list groups included in the current path -
38 become: toggle the become flag - !: forces shell module instead
39 of the ansible module (!yum update -y) - verbosity [num]: set
40 the verbosity level - forks [num]: set the number of forks - be‐
41 come_user [user]: set the become_user - remote_user [user]: set
42 the remote_user - become_method [method]: set the privilege es‐
43 calation method - check [bool]: toggle check mode - diff [bool]:
44 toggle diff mode - timeout [integer]: set the timeout of tasks
45 in seconds (0 to disable) - help [command/module]: display docu‐
46 mentation for the command or module - exit: exit ansible-console
47
49 host pattern
50
51 --ask-vault-password, --ask-vault-pass
52 ask for vault password
53
54 --become-method 'BECOME_METHOD'
55 privilege escalation method to use (default=sudo), use ansible-doc
56 -t become -l to list valid choices.
57
58 --become-password-file 'BECOME_PASSWORD_FILE', --become-pass-file 'BE‐
59 COME_PASSWORD_FILE'
60 Become password file
61
62 --become-user 'BECOME_USER'
63 run operations as this user (default=root)
64
65 --connection-password-file 'CONNECTION_PASSWORD_FILE', --conn-pass-file
66 'CONNECTION_PASSWORD_FILE'
67 Connection password file
68
69 --list-hosts
70 outputs a list of matching hosts; does not execute anything else
71
72 --playbook-dir 'BASEDIR'
73 Since this tool does not use playbooks, use this as a substitute
74 playbook directory. This sets the relative path for many features
75 including roles/ group_vars/ etc.
76
77 --private-key 'PRIVATE_KEY_FILE', --key-file 'PRIVATE_KEY_FILE'
78 use this file to authenticate the connection
79
80 --scp-extra-args 'SCP_EXTRA_ARGS'
81 specify extra arguments to pass to scp only (e.g. -l)
82
83 --sftp-extra-args 'SFTP_EXTRA_ARGS'
84 specify extra arguments to pass to sftp only (e.g. -f, -l)
85
86 --ssh-common-args 'SSH_COMMON_ARGS'
87 specify common arguments to pass to sftp/scp/ssh (e.g. ProxyCommand)
88
89 --ssh-extra-args 'SSH_EXTRA_ARGS'
90 specify extra arguments to pass to ssh only (e.g. -R)
91
92 --step
93 one-step-at-a-time: confirm each task before running
94
95 --syntax-check
96 perform a syntax check on the playbook, but do not execute it
97
98 --task-timeout 'TASK_TIMEOUT'
99 set task timeout limit in seconds, must be positive integer.
100
101 --vault-id
102 the vault identity to use
103
104 --vault-password-file, --vault-pass-file
105 vault password file
106
107 --version
108 show program's version number, config file location, configured mod‐
109 ule search path, module location, executable location and exit
110
111 -C, --check
112 don't make any changes; instead, try to predict some of the changes
113 that may occur
114
115 -D, --diff
116 when changing (small) files and templates, show the differences in
117 those files; works great with --check
118
119 -K, --ask-become-pass
120 ask for privilege escalation password
121
122 -M, --module-path
123 prepend colon-separated path(s) to module library (default={{ ANSI‐
124 BLE_HOME ~ "/plugins/modules:/usr/share/ansible/plugins/modules" }})
125
126 -T 'TIMEOUT', --timeout 'TIMEOUT'
127 override the connection timeout in seconds (default=10)
128
129 -b, --become
130 run operations with become (does not imply password prompting)
131
132 -c 'CONNECTION', --connection 'CONNECTION'
133 connection type to use (default=smart)
134
135 -e, --extra-vars
136 set additional variables as key=value or YAML/JSON, if filename
137 prepend with @
138
139 -f 'FORKS', --forks 'FORKS'
140 specify number of parallel processes to use (default=5)
141
142 -h, --help
143 show this help message and exit
144
145 -i, --inventory, --inventory-file
146 specify inventory host path or comma separated host list. --inven‐
147 tory-file is deprecated
148
149 -k, --ask-pass
150 ask for connection password
151
152 -l 'SUBSET', --limit 'SUBSET'
153 further limit selected hosts to an additional pattern
154
155 -u 'REMOTE_USER', --user 'REMOTE_USER'
156 connect as this user (default=None)
157
158 -v, --verbose
159 Causes Ansible to print more debug messages. Adding multiple -v will
160 increase the verbosity, the builtin plugins currently evaluate up to
161 -vvvvvv. A reasonable level to start is -vvv, connection debugging
162 might require -vvvv.
163
165 The following environment variables may be specified.
166
167 ANSIBLE_CONFIG -- Specify override location for the ansible config file
168
169 Many more are available for most options in ansible.cfg
170
171 For a full list check https://docs.ansible.com/. or use the ansi‐
172 ble-config command.
173
175 /etc/ansible/ansible.cfg -- Config file, used if present
176
177 ~/.ansible.cfg -- User config file, overrides the default config if
178 present
179
180 ./ansible.cfg -- Local config file (in current working directory) as‐
181 sumed to be 'project specific' and overrides the rest if present.
182
183 As mentioned above, the ANSIBLE_CONFIG environment variable will over‐
184 ride all others.
185
187 Ansible was originally written by Michael DeHaan.
188
190 Copyright © 2018 Red Hat, Inc | Ansible. Ansible is released under the
191 terms of the GPLv3 license.
192
194 ansible (1), ansible-config (1), ansible-doc (1), ansible-galaxy [22m(1),
195 ansible-inventory [22m(1), ansible-playbook [22m(1), ansible-pull (1), ansi‐
196 ble-vault (1)
197
198 Extensive documentation is available in the documentation site: <‐
199 https://docs.ansible.com>. IRC and mailing list info can be found in
200 file CONTRIBUTING.md, available in: <‐
201 https://github.com/ansible/ansible>
202
203
204
205
206Ansible 2.14.1 ANSIBLE-CONSOLE(1)