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,9 +28,14 @@
import os import os
import tower_cli.utils.exceptions as exc try:
from tower_cli.utils import parser import tower_cli.utils.exceptions as exc
from tower_cli.api import client from tower_cli.utils import parser
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):

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,56 +152,52 @@ 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=dict( argument_spec = tower_argument_spec()
name=dict(required=True), argument_spec.update(dict(
user=dict(), name=dict(required=True),
team=dict(), user=dict(),
kind=dict(required=True, team=dict(),
choices=["ssh", "net", "scm", "aws", "rax", "vmware", "satellite6", kind=dict(required=True,
"cloudforms", "gce", "azure", "azure_rm", "openstack"]), choices=["ssh", "net", "scm", "aws", "rax", "vmware", "satellite6",
host=dict(), "cloudforms", "gce", "azure", "azure_rm", "openstack"]),
username=dict(), host=dict(),
password=dict(no_log=True), username=dict(),
ssh_key_data=dict(no_log=True), password=dict(no_log=True),
ssh_key_unlock=dict(no_log=True), ssh_key_data=dict(no_log=True),
authorize=dict(type='bool', default=False), ssh_key_unlock=dict(no_log=True),
authorize_password=dict(no_log=True), authorize=dict(type='bool', default=False),
client=dict(), authorize_password=dict(no_log=True),
secret=dict(), client=dict(),
tenant=dict(), secret=dict(),
subscription=dict(), tenant=dict(),
domain=dict(), subscription=dict(),
become_method=dict(), domain=dict(),
become_username=dict(), become_method=dict(),
become_password=dict(no_log=True), become_username=dict(),
vault_password=dict(no_log=True), become_password=dict(no_log=True),
description=dict(), vault_password=dict(no_log=True),
organization=dict(required=True), description=dict(),
project=dict(), organization=dict(required=True),
tower_host=dict(), project=dict(),
tower_username=dict(), state=dict(choices=['present', 'absent'], default='present'),
tower_password=dict(no_log=True), ))
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
state=dict(choices=['present', 'absent'], default='present'),
),
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,48 +112,42 @@ 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),
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(), state=dict(choices=['present', 'absent'], default='present'),
tower_username=dict(), ))
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
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 = '''
''' '''
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),
enabled=dict(type='bool', default=True), enabled=dict(type='bool', default=True),
variables=dict(), variables=dict(),
tower_host=dict(), state=dict(choices=['present', 'absent'], default='present'),
tower_username=dict(), ))
tower_password=dict(no_log=True), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
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(), state=dict(choices=['present', 'absent'], default='present'),
tower_username=dict(), ))
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
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,40 +213,35 @@ 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),
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(), state=dict(choices=['present', 'absent'], default='present'),
tower_username=dict(), ))
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
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(), state=dict(choices=['present', 'absent'], default='present'),
tower_username=dict(), ))
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
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(), state=dict(choices=['present', 'absent'], default='present'),
tower_username=dict(), ))
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
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,42 +99,36 @@ 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(),
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_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,26 +126,22 @@ def update_resources(module, p):
def main(): def main():
module = AnsibleModule(
argument_spec=dict( argument_spec = tower_argument_spec()
user=dict(), argument_spec.update(dict(
team=dict(), user=dict(),
role=dict(choices=["admin", "read", "member", "execute", "adhoc", "update", "use", "auditor"]), team=dict(),
target_team=dict(), role=dict(choices=["admin", "read", "member", "execute", "adhoc", "update", "use", "auditor"]),
inventory=dict(), target_team=dict(),
job_template=dict(), inventory=dict(),
credential=dict(), job_template=dict(),
organization=dict(), credential=dict(),
project=dict(), organization=dict(),
tower_host=dict(), project=dict(),
tower_username=dict(), state=dict(choices=['present', 'absent'], default='present'),
tower_password=dict(no_log=True), ))
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
state=dict(choices=['present', 'absent'], default='present'),
),
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()
name=dict(required=True), argument_spec.update(dict(
description=dict(), name=dict(required=True),
organization=dict(required=True), description=dict(),
tower_host=dict(), organization=dict(required=True),
tower_username=dict(), state=dict(choices=['present', 'absent'], default='present'),
tower_password=dict(no_log=True), ))
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
state=dict(choices=['present', 'absent'], default='present'),
),
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,37 +78,31 @@ 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(),
password=dict(no_log=True), password=dict(no_log=True),
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(), state=dict(choices=['present', 'absent'], default='present'),
tower_username=dict(), ))
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True), module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
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