1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ansible_tower: fix broken import, reuse tower_argument_spec and documentation fragment (#29115)

* module_utils/ansible_tower: fix broken import

* tower_*: use tower_argument_spec & doc fragment

* tower doc fragment: Ansible requires Python 2.6+

* tower_job_wait: fix broken import (Py3 compat)
This commit is contained in:
Pilou 2017-10-02 22:21:24 +02:00 committed by Brian Coca
parent af3e8950d6
commit 44f5b2bd25
18 changed files with 244 additions and 746 deletions

View file

@ -28,10 +28,15 @@
import os import os
try:
import tower_cli.utils.exceptions as exc import tower_cli.utils.exceptions as exc
from tower_cli.utils import parser from tower_cli.utils import parser
from tower_cli.api import client from tower_cli.api import client
HAS_TOWER_CLI = True
except ImportError:
HAS_TOWER_CLI = False
def tower_auth_config(module): def tower_auth_config(module):
'''tower_auth_config attempts to load the tower-cli.cfg file '''tower_auth_config attempts to load the tower-cli.cfg file

View file

@ -138,45 +138,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.2"
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
''' '''
@ -190,22 +152,23 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg" tower_config_file: "~/tower_cli.cfg"
''' '''
try:
import os import os
from ansible.module_utils.ansible_tower import tower_argument_spec, tower_auth_config, tower_check_mode, HAS_TOWER_CLI
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 main(): def main():
module = AnsibleModule(
argument_spec=dict( argument_spec = tower_argument_spec()
argument_spec.update(dict(
name=dict(required=True), name=dict(required=True),
user=dict(), user=dict(),
team=dict(), team=dict(),
@ -231,15 +194,10 @@ def main():
description=dict(), description=dict(),
organization=dict(required=True), organization=dict(required=True),
project=dict(), project=dict(),
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')

View file

@ -98,45 +98,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.2"
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
''' '''
@ -150,23 +112,22 @@ EXAMPLES = '''
tower_config_file: "~/tower_cli.cfg" tower_config_file: "~/tower_cli.cfg"
''' '''
import os
from ansible.module_utils.ansible_tower import tower_argument_spec, tower_auth_config, tower_check_mode, HAS_TOWER_CLI
try: try:
import os
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 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(),
inventory=dict(required=True), inventory=dict(required=True),
@ -183,15 +144,10 @@ def main():
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_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')

View file

@ -50,45 +50,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
''' '''
@ -103,36 +65,30 @@ EXAMPLES = '''
''' '''
try:
import os import os
from ansible.module_utils.ansible_tower import tower_argument_spec, tower_auth_config, tower_check_mode, HAS_TOWER_CLI
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 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(),
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_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')

View file

@ -47,45 +47,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
''' '''
@ -100,34 +62,28 @@ EXAMPLES = '''
''' '''
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 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(),
organization=dict(required=True), organization=dict(required=True),
variables=dict(), variables=dict(),
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')

View file

@ -56,20 +56,15 @@ status:
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ansible_tower import tower_auth_config, tower_check_mode, tower_argument_spec, 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,
tower_argument_spec,
)
HAS_TOWER_CLI = True
except ImportError: except ImportError:
HAS_TOWER_CLI = False pass
def main(): def main():

View file

@ -90,20 +90,15 @@ status:
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ansible_tower import tower_auth_config, tower_check_mode, tower_argument_spec, 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,
tower_argument_spec,
)
HAS_TOWER_CLI = True
except ImportError: except ImportError:
HAS_TOWER_CLI = False pass
def main(): def main():

View file

@ -82,20 +82,15 @@ results:
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ansible_tower import tower_auth_config, tower_check_mode, tower_argument_spec, 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,
tower_argument_spec,
)
HAS_TOWER_CLI = True
except ImportError: except ImportError:
HAS_TOWER_CLI = False pass
def main(): def main():

View file

@ -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')

View file

@ -82,27 +82,18 @@ status:
''' '''
from ansible.module_utils.ansible_tower import tower_auth_config, tower_check_mode, tower_argument_spec, HAS_TOWER_CLI
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six.moves import cStringIO as StringIO
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
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,
tower_argument_spec,
)
HAS_TOWER_CLI = True
except ImportError: except ImportError:
HAS_TOWER_CLI = False pass
def main(): def main():

View file

@ -39,45 +39,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
''' '''
@ -90,32 +52,26 @@ 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 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),
organization=dict(required=True), organization=dict(required=True),
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')

View file

@ -38,45 +38,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(tower_config_file) is provided we will attempt to use the tower-cli library
defaults to find your Tower host information.
- I(tower_config_file) should contain Tower configuration in the following format
host=hostname
username=username
password=password
''' '''
@ -89,32 +51,26 @@ 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 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(),
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')

View file

@ -85,45 +85,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
''' '''
@ -137,21 +99,20 @@ 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 main(): def main():
module = AnsibleModule( argument_spec = tower_argument_spec()
argument_spec=dict( argument_spec.update(dict(
name=dict(), name=dict(),
description=dict(), description=dict(),
organization=dict(), organization=dict(),
@ -163,16 +124,11 @@ def main():
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_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')

View file

@ -74,45 +74,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
''' '''
@ -126,16 +88,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_resources(module, p): def update_resources(module, p):
@ -165,8 +126,9 @@ def update_resources(module, p):
def main(): def main():
module = AnsibleModule(
argument_spec=dict( argument_spec = tower_argument_spec()
argument_spec.update(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"]),
@ -176,15 +138,10 @@ def main():
credential=dict(), credential=dict(),
organization=dict(), organization=dict(),
project=dict(), project=dict(),
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')

View file

@ -39,45 +39,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
''' '''
@ -91,33 +53,28 @@ 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 main(): def main():
module = AnsibleModule(
argument_spec=dict( argument_spec = tower_argument_spec()
argument_spec.update(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_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')

View file

@ -62,45 +62,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
''' '''
@ -116,21 +78,20 @@ 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 main(): def main():
module = AnsibleModule( argument_spec = tower_argument_spec()
argument_spec=dict( argument_spec.update(dict(
username=dict(required=True), username=dict(required=True),
first_name=dict(), first_name=dict(),
last_name=dict(), last_name=dict(),
@ -138,15 +99,10 @@ def main():
email=dict(required=True), email=dict(required=True),
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_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')

View file

@ -51,7 +51,6 @@ options:
requirements: requirements:
- "python >= 2.6"
- "ansible-tower-cli >= 3.0.2" - "ansible-tower-cli >= 3.0.2"
notes: notes:

View file

@ -1,4 +1,3 @@
lib/ansible/module_utils/ansible_tower.py
lib/ansible/modules/cloud/amazon/cloudtrail.py lib/ansible/modules/cloud/amazon/cloudtrail.py
lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py
lib/ansible/modules/cloud/amazon/ec2_vpc_route_table.py lib/ansible/modules/cloud/amazon/ec2_vpc_route_table.py
@ -56,4 +55,3 @@ lib/ansible/modules/network/lenovo/cnos_vlag.py
lib/ansible/modules/network/lenovo/cnos_vlan.py lib/ansible/modules/network/lenovo/cnos_vlan.py
lib/ansible/modules/network/nxos/nxos_file_copy.py lib/ansible/modules/network/nxos/nxos_file_copy.py
lib/ansible/modules/packaging/language/maven_artifact.py lib/ansible/modules/packaging/language/maven_artifact.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py