Pep8 fixes for web_infra/ansible_tower (#24479)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
fc3cc73b73
commit
728d3e6c84
16 changed files with 238 additions and 253 deletions
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -213,38 +213,38 @@ except ImportError:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
name = dict(required=True),
|
name=dict(required=True),
|
||||||
user = dict(),
|
user=dict(),
|
||||||
team = dict(),
|
team=dict(),
|
||||||
kind = dict(required=True,
|
kind=dict(required=True,
|
||||||
choices=["ssh", "net", "scm", "aws", "rax", "vmware", "satellite6",
|
choices=["ssh", "net", "scm", "aws", "rax", "vmware", "satellite6",
|
||||||
"cloudforms", "gce", "azure", "azure_rm", "openstack"]),
|
"cloudforms", "gce", "azure", "azure_rm", "openstack"]),
|
||||||
host = dict(),
|
host=dict(),
|
||||||
username = dict(),
|
username=dict(),
|
||||||
password = dict(no_log=True),
|
password=dict(no_log=True),
|
||||||
ssh_key_data = dict(no_log=True),
|
ssh_key_data=dict(no_log=True),
|
||||||
ssh_key_unlock = dict(no_log=True),
|
ssh_key_unlock=dict(no_log=True),
|
||||||
authorize = dict(type='bool', default=False),
|
authorize=dict(type='bool', default=False),
|
||||||
authorize_password = dict(no_log=True),
|
authorize_password=dict(no_log=True),
|
||||||
client = dict(),
|
client=dict(),
|
||||||
secret = dict(),
|
secret=dict(),
|
||||||
tenant = dict(),
|
tenant=dict(),
|
||||||
subscription = dict(),
|
subscription=dict(),
|
||||||
domain = dict(),
|
domain=dict(),
|
||||||
become_method = dict(),
|
become_method=dict(),
|
||||||
become_username = dict(),
|
become_username=dict(),
|
||||||
become_password = dict(no_log=True),
|
become_password=dict(no_log=True),
|
||||||
vault_password = dict(no_log=True),
|
vault_password=dict(no_log=True),
|
||||||
description = dict(),
|
description=dict(),
|
||||||
organization = dict(required=True),
|
organization=dict(required=True),
|
||||||
project = dict(),
|
project=dict(),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -174,29 +174,29 @@ except ImportError:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
name = dict(required=True),
|
name=dict(required=True),
|
||||||
description = dict(),
|
description=dict(),
|
||||||
inventory = dict(required=True),
|
inventory=dict(required=True),
|
||||||
variables = dict(),
|
variables=dict(),
|
||||||
credential = dict(),
|
credential=dict(),
|
||||||
source = dict(choices=["manual", "file", "ec2", "rax", "vmware",
|
source=dict(choices=["manual", "file", "ec2", "rax", "vmware",
|
||||||
"gce", "azure", "azure_rm", "openstack",
|
"gce", "azure", "azure_rm", "openstack",
|
||||||
"satellite6" , "cloudforms", "custom"], default="manual"),
|
"satellite6", "cloudforms", "custom"], default="manual"),
|
||||||
source_regions = dict(),
|
source_regions=dict(),
|
||||||
source_vars = dict(),
|
source_vars=dict(),
|
||||||
instance_filters = dict(),
|
instance_filters=dict(),
|
||||||
group_by = dict(),
|
group_by=dict(),
|
||||||
source_script = dict(),
|
source_script=dict(),
|
||||||
overwrite = dict(type='bool', default=False),
|
overwrite=dict(type='bool', default=False),
|
||||||
overwrite_vars = dict(),
|
overwrite_vars=dict(),
|
||||||
update_on_launch = dict(type='bool' , default=False),
|
update_on_launch=dict(type='bool', default=False),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -126,18 +126,18 @@ except ImportError:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
name = dict(required=True),
|
name=dict(required=True),
|
||||||
description = dict(),
|
description=dict(),
|
||||||
inventory = dict(required=True),
|
inventory=dict(required=True),
|
||||||
enabled = dict(type='bool', default=True),
|
enabled=dict(type='bool', default=True),
|
||||||
variables = dict(),
|
variables=dict(),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
@ -170,7 +170,7 @@ def main():
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
result = host.modify(name=name, inventory=inv['id'], enabled=enabled,
|
result = host.modify(name=name, inventory=inv['id'], enabled=enabled,
|
||||||
variables=variables, description=description, create_on_missing=True)
|
variables=variables, description=description, create_on_missing=True)
|
||||||
json_output['id'] = result['id']
|
json_output['id'] = result['id']
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
result = host.delete(name=name, inventory=inv['id'])
|
result = host.delete(name=name, inventory=inv['id'])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -122,17 +122,17 @@ except ImportError:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
name = dict(required=True),
|
name=dict(required=True),
|
||||||
description = dict(),
|
description=dict(),
|
||||||
organization = dict(required=True),
|
organization=dict(required=True),
|
||||||
variables = dict(),
|
variables=dict(),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
@ -159,7 +159,7 @@ def main():
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
result = inventory.modify(name=name, organization=org['id'], variables=variables,
|
result = inventory.modify(name=name, organization=org['id'], variables=variables,
|
||||||
description=description, create_on_missing=True)
|
description=description, create_on_missing=True)
|
||||||
json_output['id'] = result['id']
|
json_output['id'] = result['id']
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
result = inventory.delete(name=name, organization=org['id'])
|
result = inventory.delete(name=name, organization=org['id'])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -83,12 +83,12 @@ except ImportError:
|
||||||
def main():
|
def main():
|
||||||
argument_spec = tower_argument_spec()
|
argument_spec = tower_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
job_id = dict(type='int', required=True),
|
job_id=dict(type='int', required=True),
|
||||||
fail_if_not_running = dict(type='bool', default=False),
|
fail_if_not_running=dict(type='bool', default=False),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -117,13 +117,13 @@ except ImportError:
|
||||||
def main():
|
def main():
|
||||||
argument_spec = tower_argument_spec()
|
argument_spec = tower_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
job_template = dict(required=True),
|
job_template=dict(required=True),
|
||||||
job_type = dict(choices=['run', 'check', 'scan']),
|
job_type=dict(choices=['run', 'check', 'scan']),
|
||||||
inventory = dict(),
|
inventory=dict(),
|
||||||
credential = dict(),
|
credential=dict(),
|
||||||
limit = dict(),
|
limit=dict(),
|
||||||
tags = dict(type='list'),
|
tags=dict(type='list'),
|
||||||
extra_vars = dict(type='list'),
|
extra_vars=dict(type='list'),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -109,14 +109,14 @@ except ImportError:
|
||||||
def main():
|
def main():
|
||||||
argument_spec = tower_argument_spec()
|
argument_spec = tower_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
status = dict(choices=['pending', 'waiting', 'running', 'error', 'failed', 'canceled', 'successful']),
|
status=dict(choices=['pending', 'waiting', 'running', 'error', 'failed', 'canceled', 'successful']),
|
||||||
page = dict(type='int'),
|
page=dict(type='int'),
|
||||||
all_pages = dict(type='bool', default=False),
|
all_pages=dict(type='bool', default=False),
|
||||||
query = dict(type='dict'),
|
query=dict(type='dict'),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ def main():
|
||||||
tower_check_mode(module)
|
tower_check_mode(module)
|
||||||
try:
|
try:
|
||||||
job = tower_cli.get_resource('job')
|
job = tower_cli.get_resource('job')
|
||||||
params = {'status':status, 'page':page, 'all_pages': all_pages}
|
params = {'status': status, 'page': page, 'all_pages': all_pages}
|
||||||
if query:
|
if query:
|
||||||
params['query'] = query.items()
|
params['query'] = query.items()
|
||||||
json_output = job.list(**params)
|
json_output = job.list(**params)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -220,7 +220,7 @@ def update_fields(p):
|
||||||
params = p.copy()
|
params = p.copy()
|
||||||
field_map = {
|
field_map = {
|
||||||
'ask_extra_vars': 'ask_variables_on_launch',
|
'ask_extra_vars': 'ask_variables_on_launch',
|
||||||
'ask_limit' :'ask_limit_on_launch',
|
'ask_limit': 'ask_limit_on_launch',
|
||||||
'ask_tags': 'ask_tags_on_launch',
|
'ask_tags': 'ask_tags_on_launch',
|
||||||
'ask_job_type': 'ask_job_type_on_launch',
|
'ask_job_type': 'ask_job_type_on_launch',
|
||||||
'machine_credential': 'credential',
|
'machine_credential': 'credential',
|
||||||
|
@ -248,11 +248,11 @@ def update_resources(module, p):
|
||||||
'network_credential': 'name',
|
'network_credential': 'name',
|
||||||
'cloud_credential': 'name',
|
'cloud_credential': 'name',
|
||||||
}
|
}
|
||||||
for k,v in identity_map.items():
|
for k, v in identity_map.items():
|
||||||
try:
|
try:
|
||||||
if params[k]:
|
if params[k]:
|
||||||
key = 'credential' if '_credential' in k else k
|
key = 'credential' if '_credential' in k else k
|
||||||
result = tower_cli.get_resource(key).get(**{v:params[k]})
|
result = tower_cli.get_resource(key).get(**{v: params[k]})
|
||||||
params[k] = result['id']
|
params[k] = result['id']
|
||||||
except (exc.NotFound) as excinfo:
|
except (exc.NotFound) as excinfo:
|
||||||
module.fail_json(msg='Failed to update job template: {0}'.format(excinfo), changed=False)
|
module.fail_json(msg='Failed to update job template: {0}'.format(excinfo), changed=False)
|
||||||
|
@ -261,36 +261,36 @@ def update_resources(module, p):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
name = dict(required=True),
|
name=dict(required=True),
|
||||||
description = dict(),
|
description=dict(),
|
||||||
job_type = dict(choices=['run', 'check', 'scan'], required=True),
|
job_type=dict(choices=['run', 'check', 'scan'], required=True),
|
||||||
inventory = dict(),
|
inventory=dict(),
|
||||||
project = dict(required=True),
|
project=dict(required=True),
|
||||||
playbook = dict(required=True),
|
playbook=dict(required=True),
|
||||||
machine_credential = dict(),
|
machine_credential=dict(),
|
||||||
cloud_credential = dict(),
|
cloud_credential=dict(),
|
||||||
network_credential = dict(),
|
network_credential=dict(),
|
||||||
forks = dict(type='int'),
|
forks=dict(type='int'),
|
||||||
limit = dict(),
|
limit=dict(),
|
||||||
verbosity = dict(choices=['verbose', 'debug']),
|
verbosity=dict(choices=['verbose', 'debug']),
|
||||||
job_tags = dict(),
|
job_tags=dict(),
|
||||||
skip_tags = dict(),
|
skip_tags=dict(),
|
||||||
host_config_key = dict(),
|
host_config_key=dict(),
|
||||||
extra_vars_path = dict(type='path', required=False),
|
extra_vars_path=dict(type='path', required=False),
|
||||||
ask_extra_vars = dict(type='bool', default=False),
|
ask_extra_vars=dict(type='bool', default=False),
|
||||||
ask_limit = dict(type='bool', default=False),
|
ask_limit=dict(type='bool', default=False),
|
||||||
ask_tags = dict(type='bool', default=False),
|
ask_tags=dict(type='bool', default=False),
|
||||||
ask_job_type = dict(type='bool', default=False),
|
ask_job_type=dict(type='bool', default=False),
|
||||||
ask_inventory = dict(type='bool', default=False),
|
ask_inventory=dict(type='bool', default=False),
|
||||||
ask_credential = dict(type='bool', default=False),
|
ask_credential=dict(type='bool', default=False),
|
||||||
become_enabled = dict(type='bool', default=False),
|
become_enabled=dict(type='bool', default=False),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -116,10 +116,10 @@ except ImportError:
|
||||||
def main():
|
def main():
|
||||||
argument_spec = tower_argument_spec()
|
argument_spec = tower_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
job_id = dict(type='int', required=True),
|
job_id=dict(type='int', required=True),
|
||||||
timeout = dict(type='int'),
|
timeout=dict(type='int'),
|
||||||
min_interval = dict(type='float', default=1),
|
min_interval=dict(type='float', default=1),
|
||||||
max_interval = dict(type='float', default=30),
|
max_interval=dict(type='float', default=30),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -112,15 +112,15 @@ except ImportError:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
name = dict(required=True),
|
name=dict(required=True),
|
||||||
organization = dict(required=True),
|
organization=dict(required=True),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -111,15 +111,15 @@ except ImportError:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
name = dict(required=True),
|
name=dict(required=True),
|
||||||
description = dict(),
|
description=dict(),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -159,25 +159,25 @@ except ImportError:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
name = dict(),
|
name=dict(),
|
||||||
description = dict(),
|
description=dict(),
|
||||||
organization = dict(),
|
organization=dict(),
|
||||||
scm_type = dict(choices=['manual', 'git', 'hg', 'svn'], default='manual'),
|
scm_type=dict(choices=['manual', 'git', 'hg', 'svn'], default='manual'),
|
||||||
scm_url = dict(),
|
scm_url=dict(),
|
||||||
scm_branch = dict(),
|
scm_branch=dict(),
|
||||||
scm_credential = dict(),
|
scm_credential=dict(),
|
||||||
scm_clean = dict(type='bool', default=False),
|
scm_clean=dict(type='bool', default=False),
|
||||||
scm_delete_on_update = dict(type='bool', default=False),
|
scm_delete_on_update=dict(type='bool', default=False),
|
||||||
scm_update_on_launch = dict(type='bool', default=False),
|
scm_update_on_launch=dict(type='bool', default=False),
|
||||||
local_path = dict(),
|
local_path=dict(),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
|
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -152,20 +152,20 @@ def update_resources(module, p):
|
||||||
'''
|
'''
|
||||||
params = p.copy()
|
params = p.copy()
|
||||||
identity_map = {
|
identity_map = {
|
||||||
'user':'username',
|
'user': 'username',
|
||||||
'team':'name',
|
'team': 'name',
|
||||||
'target_team':'name',
|
'target_team': 'name',
|
||||||
'inventory':'name',
|
'inventory': 'name',
|
||||||
'job_template':'name',
|
'job_template': 'name',
|
||||||
'credential':'name',
|
'credential': 'name',
|
||||||
'organization':'name',
|
'organization': 'name',
|
||||||
'project':'name',
|
'project': 'name',
|
||||||
}
|
}
|
||||||
for k,v in identity_map.items():
|
for k, v in identity_map.items():
|
||||||
try:
|
try:
|
||||||
if params[k]:
|
if params[k]:
|
||||||
key = 'team' if k == 'target_team' else k
|
key = 'team' if k == 'target_team' else k
|
||||||
result = tower_cli.get_resource(key).get(**{v:params[k]})
|
result = tower_cli.get_resource(key).get(**{v: params[k]})
|
||||||
params[k] = result['id']
|
params[k] = result['id']
|
||||||
except (exc.NotFound) as excinfo:
|
except (exc.NotFound) as excinfo:
|
||||||
module.fail_json(msg='Failed to update role, {0} not found: {1}'.format(k, excinfo), changed=False)
|
module.fail_json(msg='Failed to update role, {0} not found: {1}'.format(k, excinfo), changed=False)
|
||||||
|
@ -174,22 +174,22 @@ def update_resources(module, p):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
user = dict(),
|
user=dict(),
|
||||||
team = dict(),
|
team=dict(),
|
||||||
role = dict(choices=["admin", "read", "member", "execute", "adhoc", "update", "use", "auditor"]),
|
role=dict(choices=["admin", "read", "member", "execute", "adhoc", "update", "use", "auditor"]),
|
||||||
target_team = dict(),
|
target_team=dict(),
|
||||||
inventory = dict(),
|
inventory=dict(),
|
||||||
job_template = dict(),
|
job_template=dict(),
|
||||||
credential = dict(),
|
credential=dict(),
|
||||||
organization = dict(),
|
organization=dict(),
|
||||||
project = dict(),
|
project=dict(),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -113,16 +113,16 @@ except ImportError:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
name = dict(required=True),
|
name=dict(required=True),
|
||||||
description = dict(),
|
description=dict(),
|
||||||
organization = dict(required=True),
|
organization=dict(required=True),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
@ -148,7 +148,7 @@ def main():
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
result = team.modify(name=name, organization=org['id'],
|
result = team.modify(name=name, organization=org['id'],
|
||||||
description=description, create_on_missing=True)
|
description=description, create_on_missing=True)
|
||||||
json_output['id'] = result['id']
|
json_output['id'] = result['id']
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
result = team.delete(name=name, organization=org['id'])
|
result = team.delete(name=name, organization=org['id'])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
#coding: utf-8 -*-
|
# coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
|
||||||
#
|
#
|
||||||
|
@ -143,21 +143,21 @@ except ImportError:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec=dict(
|
||||||
username = dict(required=True),
|
username=dict(required=True),
|
||||||
first_name = dict(),
|
first_name=dict(),
|
||||||
last_name = dict(),
|
last_name=dict(),
|
||||||
password = dict(no_log=True),
|
password=dict(no_log=True),
|
||||||
email = dict(required=True),
|
email=dict(required=True),
|
||||||
organization = dict(),
|
organization=dict(),
|
||||||
superuser = dict(type='bool', default=False),
|
superuser=dict(type='bool', default=False),
|
||||||
auditor = dict(type='bool', default=False),
|
auditor=dict(type='bool', default=False),
|
||||||
tower_host = dict(),
|
tower_host=dict(),
|
||||||
tower_username = dict(),
|
tower_username=dict(),
|
||||||
tower_password = dict(no_log=True),
|
tower_password=dict(no_log=True),
|
||||||
tower_verify_ssl = dict(type='bool', default=True),
|
tower_verify_ssl=dict(type='bool', default=True),
|
||||||
tower_config_file = dict(type='path'),
|
tower_config_file=dict(type='path'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
@ -184,8 +184,8 @@ def main():
|
||||||
try:
|
try:
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
result = user.modify(username=username, first_name=first_name, last_name=last_name,
|
result = user.modify(username=username, first_name=first_name, last_name=last_name,
|
||||||
email=email, password=password, organization=organization,
|
email=email, password=password, organization=organization,
|
||||||
is_superuser=superuser, is_auditor=auditor, create_on_missing=True)
|
is_superuser=superuser, is_auditor=auditor, create_on_missing=True)
|
||||||
json_output['id'] = result['id']
|
json_output['id'] = result['id']
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
result = user.delete(username=username)
|
result = user.delete(username=username)
|
||||||
|
|
|
@ -702,21 +702,6 @@ lib/ansible/modules/utilities/helper/_accelerate.py
|
||||||
lib/ansible/modules/utilities/logic/async_status.py
|
lib/ansible/modules/utilities/logic/async_status.py
|
||||||
lib/ansible/modules/utilities/logic/async_wrapper.py
|
lib/ansible/modules/utilities/logic/async_wrapper.py
|
||||||
lib/ansible/modules/utilities/logic/wait_for.py
|
lib/ansible/modules/utilities/logic/wait_for.py
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_cancel.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py
|
|
||||||
lib/ansible/modules/web_infrastructure/ejabberd_user.py
|
lib/ansible/modules/web_infrastructure/ejabberd_user.py
|
||||||
lib/ansible/modules/web_infrastructure/jboss.py
|
lib/ansible/modules/web_infrastructure/jboss.py
|
||||||
lib/ansible/parsing/dataloader.py
|
lib/ansible/parsing/dataloader.py
|
||||||
|
|
Loading…
Reference in a new issue