def init_parser(self): ''' create an options parser for bin/ansible ''' super(AdHocCLI, self).init_parser(usage='%prog <host-pattern> [options]', desc="Define and run a single task 'playbook' against" " a set of hosts", epilog="Some modules do not make sense in Ad-Hoc (include," " meta, etc)") opt_help.add_runas_options(self.parser) opt_help.add_inventory_options(self.parser) opt_help.add_async_options(self.parser) opt_help.add_output_options(self.parser) opt_help.add_connect_options(self.parser) opt_help.add_check_options(self.parser) opt_help.add_runtask_options(self.parser) opt_help.add_vault_options(self.parser) opt_help.add_fork_options(self.parser) opt_help.add_module_options(self.parser) opt_help.add_basedir_options(self.parser) # options unique to ansible ad-hoc self.parser.add_option('-a', '--args', dest='module_args', help="module arguments", default=C.DEFAULT_MODULE_ARGS) self.parser.add_option('-m', '--module-name', dest='module_name', help="module name to execute (default=%s)" % C.DEFAULT_MODULE_NAME, default=C.DEFAULT_MODULE_NAME)
def parser(): parser = opt_help.create_base_parser() opt_help.add_runas_options(parser) opt_help.add_meta_options(parser) opt_help.add_runtask_options(parser) opt_help.add_vault_options(parser) opt_help.add_async_options(parser) opt_help.add_connect_options(parser) opt_help.add_subset_options(parser) opt_help.add_check_options(parser) opt_help.add_inventory_options(parser) return parser