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 [-i INVENTORY] [--list-hosts] [-l SUBSET] [-k] [--private-key
12 PRIVATE_KEY_FILE] [-u REMOTE_USER] [-c CONNECTION] [-T TIMEOUT]
13 [--ssh-common-args SSH_COMMON_ARGS] [--sftp-extra-args SFTP_EX‐
14 TRA_ARGS] [--scp-extra-args SCP_EXTRA_ARGS] [--ssh-extra-args
15 SSH_EXTRA_ARGS] [-C] [--syntax-check] [-D] [--vault-id
16 VAULT_IDS] [--ask-vault-password | --vault-password-file
17 VAULT_PASSWORD_FILES] [-f FORKS] [-M MODULE_PATH] [--play‐
18 book-dir BASEDIR] [-e EXTRA_VARS] [--task-timeout TASK_TIMEOUT]
19 [--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
31 System Message: WARNING/2 (docs/man/man1/ansible-console.1.rst:, line
32 44)
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-user 'BECOME_USER'
58 run operations as this user (default=root)
59
60 --list-hosts
61 outputs a list of matching hosts; does not execute anything else
62
63 --playbook-dir 'BASEDIR'
64 Since this tool does not use playbooks, use this as a substitute
65 playbook directory.This sets the relative path for many features in‐
66 cluding roles/ group_vars/ etc.
67
68 --private-key 'PRIVATE_KEY_FILE', --key-file 'PRIVATE_KEY_FILE'
69 use this file to authenticate the connection
70
71 --scp-extra-args 'SCP_EXTRA_ARGS'
72 specify extra arguments to pass to scp only (e.g. -l)
73
74 --sftp-extra-args 'SFTP_EXTRA_ARGS'
75 specify extra arguments to pass to sftp only (e.g. -f, -l)
76
77 --ssh-common-args 'SSH_COMMON_ARGS'
78 specify common arguments to pass to sftp/scp/ssh (e.g. ProxyCommand)
79
80 --ssh-extra-args 'SSH_EXTRA_ARGS'
81 specify extra arguments to pass to ssh only (e.g. -R)
82
83 --step
84 one-step-at-a-time: confirm each task before running
85
86 --syntax-check
87 perform a syntax check on the playbook, but do not execute it
88
89 --task-timeout 'TASK_TIMEOUT'
90 set task timeout limit in seconds, must be positive integer.
91
92 --vault-id
93 the vault identity to use
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 -K, --ask-become-pass
111 ask for privilege escalation password
112
113 -M, --module-path
114 prepend colon-separated path(s) to module library (default=~/.ansi‐
115 ble/plugins/modules:/usr/share/ansible/plugins/modules)
116
117 -T 'TIMEOUT', --timeout 'TIMEOUT'
118 override the connection timeout in seconds (default=10)
119
120 -b, --become
121 run operations with become (does not imply password prompting)
122
123 -c 'CONNECTION', --connection 'CONNECTION'
124 connection type to use (default=smart)
125
126 -e, --extra-vars
127 set additional variables as key=value or YAML/JSON, if filename
128 prepend with @
129
130 -f 'FORKS', --forks 'FORKS'
131 specify number of parallel processes to use (default=5)
132
133 -h, --help
134 show this help message and exit
135
136 -i, --inventory, --inventory-file
137 specify inventory host path or comma separated host list. --inven‐
138 tory-file is deprecated
139
140 -k, --ask-pass
141 ask for connection password
142
143 -l 'SUBSET', --limit 'SUBSET'
144 further limit selected hosts to an additional pattern
145
146 -u 'REMOTE_USER', --user 'REMOTE_USER'
147 connect as this user (default=None)
148
149 -v, --verbose
150 verbose mode (-vvv for more, -vvvv to enable connection debugging)
151
153 The following environment variables may be specified.
154
155 ANSIBLE_CONFIG -- Specify override location for the ansible config file
156
157 Many more are available for most options in ansible.cfg
158
159 For a full list check https://docs.ansible.com/. or use the ansi‐
160 ble-config command.
161
163 /etc/ansible/ansible.cfg -- Config file, used if present
164
165 ~/.ansible.cfg -- User config file, overrides the default config if
166 present
167
168 ./ansible.cfg -- Local config file (in current working directory) as‐
169 sumed to be 'project specific' and overrides the rest if present.
170
171 As mentioned above, the ANSIBLE_CONFIG environment variable will over‐
172 ride all others.
173
175 Ansible was originally written by Michael DeHaan.
176
178 Copyright © 2018 Red Hat, Inc | Ansible. Ansible is released under the
179 terms of the GPLv3 license.
180
182 ansible (1), ansible-config (1), ansible-doc (1), ansible-galaxy [22m(1),
183 ansible-inventory [22m(1), ansible-playbook [22m(1), ansible-pull (1), ansi‐
184 ble-vault (1)
185
186 Extensive documentation is available in the documentation site: <‐
187 https://docs.ansible.com>. IRC and mailing list info can be found in
188 file CONTRIBUTING.md, available in: <‐
189 https://github.com/ansible/ansible>
190
191
192
193
194Ansible 2.11.6 ANSIBLE-CONSOLE(1)