|
|
@ -137,45 +137,7 @@ options:
|
|
|
|
required: False
|
|
|
|
required: False
|
|
|
|
default: "present"
|
|
|
|
default: "present"
|
|
|
|
choices: ["present", "absent"]
|
|
|
|
choices: ["present", "absent"]
|
|
|
|
tower_host:
|
|
|
|
extends_documentation_fragment: tower
|
|
|
|
description:
|
|
|
|
|
|
|
|
- URL to your Tower instance.
|
|
|
|
|
|
|
|
required: False
|
|
|
|
|
|
|
|
default: null
|
|
|
|
|
|
|
|
tower_username:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Username for your Tower instance.
|
|
|
|
|
|
|
|
required: False
|
|
|
|
|
|
|
|
default: null
|
|
|
|
|
|
|
|
tower_password:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Password for your Tower instance.
|
|
|
|
|
|
|
|
required: False
|
|
|
|
|
|
|
|
default: null
|
|
|
|
|
|
|
|
tower_verify_ssl:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Dis/allow insecure connections to Tower. If C(no), SSL certificates will not be validated.
|
|
|
|
|
|
|
|
This should only be used on personally controlled sites using self-signed certificates.
|
|
|
|
|
|
|
|
required: False
|
|
|
|
|
|
|
|
default: True
|
|
|
|
|
|
|
|
tower_config_file:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Path to the Tower config file. See notes.
|
|
|
|
|
|
|
|
required: False
|
|
|
|
|
|
|
|
default: null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements:
|
|
|
|
|
|
|
|
- "python >= 2.6"
|
|
|
|
|
|
|
|
- "ansible-tower-cli >= 3.0.3"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notes:
|
|
|
|
|
|
|
|
- If no I(config_file) is provided we will attempt to use the tower-cli library
|
|
|
|
|
|
|
|
defaults to find your Tower host information.
|
|
|
|
|
|
|
|
- I(config_file) should contain Tower configuration in the following format
|
|
|
|
|
|
|
|
host=hostname
|
|
|
|
|
|
|
|
username=username
|
|
|
|
|
|
|
|
password=password
|
|
|
|
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -192,16 +154,15 @@ EXAMPLES = '''
|
|
|
|
tower_config_file: "~/tower_cli.cfg"
|
|
|
|
tower_config_file: "~/tower_cli.cfg"
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.ansible_tower import tower_argument_spec, tower_auth_config, tower_check_mode, HAS_TOWER_CLI
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
import tower_cli
|
|
|
|
import tower_cli
|
|
|
|
import tower_cli.utils.exceptions as exc
|
|
|
|
import tower_cli.utils.exceptions as exc
|
|
|
|
|
|
|
|
|
|
|
|
from tower_cli.conf import settings
|
|
|
|
from tower_cli.conf import settings
|
|
|
|
from ansible.module_utils.ansible_tower import tower_auth_config, tower_check_mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HAS_TOWER_CLI = True
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
HAS_TOWER_CLI = False
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_fields(p):
|
|
|
|
def update_fields(p):
|
|
|
@ -252,8 +213,8 @@ def update_resources(module, p):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec = tower_argument_spec()
|
|
|
|
argument_spec=dict(
|
|
|
|
argument_spec.update(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),
|
|
|
@ -277,15 +238,10 @@ def main():
|
|
|
|
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_username=dict(),
|
|
|
|
|
|
|
|
tower_password=dict(no_log=True),
|
|
|
|
|
|
|
|
tower_verify_ssl=dict(type='bool', default=True),
|
|
|
|
|
|
|
|
tower_config_file=dict(type='path'),
|
|
|
|
|
|
|
|
state=dict(choices=['present', 'absent'], default='present'),
|
|
|
|
state=dict(choices=['present', 'absent'], default='present'),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
supports_check_mode=True
|
|
|
|
|
|
|
|
)
|
|
|
|
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
|
|
|
|
|
|
|
|
|
|
|
|
if not HAS_TOWER_CLI:
|
|
|
|
if not HAS_TOWER_CLI:
|
|
|
|
module.fail_json(msg='ansible-tower-cli required for this module')
|
|
|
|
module.fail_json(msg='ansible-tower-cli required for this module')
|
|
|
|