mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-03 23:14:02 -07:00
use defaults better, improve/fix setup.py
This commit is contained in:
parent
2c873a4467
commit
3da6370a65
3 changed files with 66 additions and 32 deletions
12
bin/ansible
12
bin/ansible
|
@ -26,8 +26,8 @@ import json
|
|||
import os
|
||||
import ansible
|
||||
|
||||
DEFAULT_HOST_LIST = '~/.ansible_hosts'
|
||||
DEFAULT_MODULE_PATH = '~/ansible'
|
||||
DEFAULT_HOST_LIST = '/etc/ansible/hosts'
|
||||
DEFAULT_MODULE_PATH = '/usr/share/ansible'
|
||||
DEFAULT_MODULE_NAME = 'ping'
|
||||
DEFAULT_PATTERN = '*'
|
||||
DEFAULT_FORKS = 3
|
||||
|
@ -54,7 +54,6 @@ class Cli(object):
|
|||
help="hostname pattern", default=DEFAULT_PATTERN)
|
||||
|
||||
options, args = parser.parse_args()
|
||||
host_list = self._host_list(options.host_list)
|
||||
|
||||
# TODO: more shell like splitting on module_args would
|
||||
# be a good idea
|
||||
|
@ -63,15 +62,12 @@ class Cli(object):
|
|||
module_name=options.module_name,
|
||||
module_path=options.module_path,
|
||||
module_args=options.module_args.split(' '),
|
||||
host_list=host_list,
|
||||
host_list=options.host_list,
|
||||
forks=options.forks,
|
||||
pattern=options.pattern,
|
||||
verbose=False,
|
||||
)
|
||||
|
||||
def _host_list(self, host_list):
|
||||
host_list = os.path.expanduser(host_list)
|
||||
return file(host_list).read().split("\n")
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
result = Cli().runner().run()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue