ansible.cli package¶
- 
class 
ansible.cli.SortedOptParser(usage=None, option_list=None, option_class=<class optparse.Option>, version=None, conflict_handler='error', description=None, formatter=None, add_help_option=True, prog=None, epilog=None)[source]¶ Bases:
optparse.OptionParserOptparser which sorts the options by opt before outputting –help
- 
class 
ansible.cli.CLI(args, callback=None)[source]¶ Bases:
objectcode behind bin/ansible* programs
- 
VALID_ACTIONS= ['No Actions']¶ 
- 
PAGER= 'less'¶ 
- 
LESS_OPTS= 'FRSX'¶ 
- 
static 
ask_vault_passwords(ask_new_vault_pass=False, rekey=False)[source]¶ prompt for vault password and/or password change
- 
validate_conflicts(vault_opts=False, runas_opts=False, fork_opts=False)[source]¶ check for conflicting options
- 
static 
expand_paths(option, opt, value, parser)[source]¶ optparse action callback to convert a PATH style string arg to a list of path strings.
For ex, cli arg of ‘-p /blip/foo:/foo/bar’ would be split on the default os.pathsep and the option value would be set to the list [‘/blip/foo’, ‘/foo/bar’]. Each path string in the list will also have ‘~/’ values expand via os.path.expanduser().
- 
static 
base_parser(usage='', output_opts=False, runas_opts=False, meta_opts=False, runtask_opts=False, vault_opts=False, module_opts=False, async_opts=False, connect_opts=False, subset_opts=False, check_opts=False, inventory_opts=False, epilog=None, fork_opts=False, runas_prompt_opts=False)[source]¶ create an options parser for most ansible scripts
- 
 
Submodules¶
ansible.cli.adhoc module¶
ansible.cli.console module¶
- 
class 
ansible.cli.console.ConsoleCLI(args)[source]¶ Bases:
ansible.cli.CLI,cmd.Cmd- 
modules= []¶ 
- 
do_shell(arg)[source]¶ You can run shell commands through the shell module.
eg.: shell ps uax | grep java | wc -l shell killall python shell halt -n
You can use the ! to force the shell module. eg.: !ps aux | grep java | wc -l
- 
do_serial(arg)¶ Set the number of forks
- 
do_cd(arg)[source]¶ Change active host/group. You can use hosts patterns as well eg.: cd webservers cd webservers:dbservers cd webservers:!phoenix cd webservers:&staging cd webservers:dbservers:&staging:!phoenix
- 
do_become_method(arg)[source]¶ Given a become_method, set the privilege escalation method when using become
- 
do_EOF(args)¶ Exits from the console
- 
 
ansible.cli.doc module¶
- 
class 
ansible.cli.doc.DocCLI(args)[source]¶ Bases:
ansible.cli.CLIVault command line class
ansible.cli.galaxy module¶
- 
class 
ansible.cli.galaxy.GalaxyCLI(args)[source]¶ Bases:
ansible.cli.CLI- 
SKIP_INFO_KEYS= ('name', 'description', 'readme_html', 'related', 'summary_fields', 'average_aw_composite', 'average_aw_score', 'url')¶ 
- 
VALID_ACTIONS= ('delete', 'import', 'info', 'init', 'install', 'list', 'login', 'remove', 'search', 'setup')¶ 
- 
exit_without_ignore(rc=1)[source]¶ Exits with the specified return code unless the option –ignore-errors was specified
- 
execute_init()[source]¶ Executes the init action, which creates the skeleton framework of a role that complies with the galaxy metadata format.
- 
execute_info()[source]¶ Executes the info action. This action prints out detailed information about an installed role as well as info available from the galaxy API.
- 
execute_install()[source]¶ Executes the installation action. The args list contains the roles to be installed, unless -f was specified. The list of roles can be a name (which will be downloaded via the galaxy API and github), or it can be a local .tar.gz file.
- 
execute_remove()[source]¶ Executes the remove action. The args list contains the list of roles to be removed. This list can contain more than one role.
- 
 
ansible.cli.playbook module¶
ansible.cli.pull module¶
ansible.cli.vault module¶
- 
class 
ansible.cli.vault.VaultCLI(args)[source]¶ Bases:
ansible.cli.CLIVault command line class
- 
VALID_ACTIONS= ('create', 'decrypt', 'edit', 'encrypt', 'rekey', 'view')¶ 
-