mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
PEP 8 indent cleanup. (#20800)
* PEP 8 E121 cleanup. * PEP 8 E126 cleanup. * PEP 8 E122 cleanup.
This commit is contained in:
parent
1c6bb4add9
commit
10d9318de7
244 changed files with 2873 additions and 2973 deletions
|
@ -446,7 +446,7 @@ class AzureInventory(object):
|
||||||
def _parse_cli_args(self):
|
def _parse_cli_args(self):
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Produce an Ansible Inventory file for an Azure subscription')
|
description='Produce an Ansible Inventory file for an Azure subscription')
|
||||||
parser.add_argument('--list', action='store_true', default=True,
|
parser.add_argument('--list', action='store_true', default=True,
|
||||||
help='List instances (default: True)')
|
help='List instances (default: True)')
|
||||||
parser.add_argument('--debug', action='store_true', default=False,
|
parser.add_argument('--debug', action='store_true', default=False,
|
||||||
|
|
|
@ -199,8 +199,8 @@ class CloudStackInventory(object):
|
||||||
group_name = group['name']
|
group_name = group['name']
|
||||||
if group_name and not group_name in data:
|
if group_name and not group_name in data:
|
||||||
data[group_name] = {
|
data[group_name] = {
|
||||||
'hosts': []
|
'hosts': []
|
||||||
}
|
}
|
||||||
|
|
||||||
hosts = self.cs.listVirtualMachines(projectid=project_id, domainid=domain_id)
|
hosts = self.cs.listVirtualMachines(projectid=project_id, domainid=domain_id)
|
||||||
if not hosts:
|
if not hosts:
|
||||||
|
|
|
@ -252,10 +252,10 @@ class ConsulInventory(object):
|
||||||
ok = 'passing' == check['Status']
|
ok = 'passing' == check['Status']
|
||||||
if ok:
|
if ok:
|
||||||
suffix = self.config.get_availability_suffix(
|
suffix = self.config.get_availability_suffix(
|
||||||
'available_suffix', '_available')
|
'available_suffix', '_available')
|
||||||
else:
|
else:
|
||||||
suffix = self.config.get_availability_suffix(
|
suffix = self.config.get_availability_suffix(
|
||||||
'unavailable_suffix', '_unavailable')
|
'unavailable_suffix', '_unavailable')
|
||||||
self.add_node_to_map(self.nodes_by_availability,
|
self.add_node_to_map(self.nodes_by_availability,
|
||||||
service_name + suffix, node['Node'])
|
service_name + suffix, node['Node'])
|
||||||
|
|
||||||
|
|
|
@ -353,12 +353,12 @@ or environment variables (DO_API_TOKEN)\n''')
|
||||||
def build_inventory(self):
|
def build_inventory(self):
|
||||||
'''Build Ansible inventory of droplets'''
|
'''Build Ansible inventory of droplets'''
|
||||||
self.inventory = {
|
self.inventory = {
|
||||||
'all': {
|
'all': {
|
||||||
'hosts': [],
|
'hosts': [],
|
||||||
'vars': self.group_variables
|
'vars': self.group_variables
|
||||||
},
|
},
|
||||||
'_meta': {'hostvars': {}}
|
'_meta': {'hostvars': {}}
|
||||||
}
|
}
|
||||||
|
|
||||||
# add all droplets by id and name
|
# add all droplets by id and name
|
||||||
for droplet in self.data['droplets']:
|
for droplet in self.data['droplets']:
|
||||||
|
@ -379,22 +379,22 @@ or environment variables (DO_API_TOKEN)\n''')
|
||||||
|
|
||||||
# groups that are always present
|
# groups that are always present
|
||||||
for group in [
|
for group in [
|
||||||
'region_' + droplet['region']['slug'],
|
'region_' + droplet['region']['slug'],
|
||||||
'image_' + str(droplet['image']['id']),
|
'image_' + str(droplet['image']['id']),
|
||||||
'size_' + droplet['size']['slug'],
|
'size_' + droplet['size']['slug'],
|
||||||
'distro_' + self.to_safe(droplet['image']['distribution']),
|
'distro_' + self.to_safe(droplet['image']['distribution']),
|
||||||
'status_' + droplet['status'],
|
'status_' + droplet['status'],
|
||||||
|
|
||||||
]:
|
]:
|
||||||
if group not in self.inventory:
|
if group not in self.inventory:
|
||||||
self.inventory[group] = { 'hosts': [ ], 'vars': {} }
|
self.inventory[group] = { 'hosts': [ ], 'vars': {} }
|
||||||
self.inventory[group]['hosts'].append(dest)
|
self.inventory[group]['hosts'].append(dest)
|
||||||
|
|
||||||
# groups that are not always present
|
# groups that are not always present
|
||||||
for group in [
|
for group in [
|
||||||
droplet['image']['slug'],
|
droplet['image']['slug'],
|
||||||
droplet['image']['name']
|
droplet['image']['name']
|
||||||
]:
|
]:
|
||||||
if group:
|
if group:
|
||||||
image = 'image_' + self.to_safe(group)
|
image = 'image_' + self.to_safe(group)
|
||||||
if image not in self.inventory:
|
if image not in self.inventory:
|
||||||
|
|
|
@ -676,7 +676,7 @@ class DockerInventory(object):
|
||||||
# use hosts from config file
|
# use hosts from config file
|
||||||
for host in hosts_list:
|
for host in hosts_list:
|
||||||
docker_host = host.get('host') or def_host or self._args.docker_host or \
|
docker_host = host.get('host') or def_host or self._args.docker_host or \
|
||||||
self._env_args.docker_host or DEFAULT_DOCKER_HOST
|
self._env_args.docker_host or DEFAULT_DOCKER_HOST
|
||||||
api_version = host.get('version') or def_version or self._args.api_version or \
|
api_version = host.get('version') or def_version or self._args.api_version or \
|
||||||
self._env_args.api_version or DEFAULT_DOCKER_API_VERSION
|
self._env_args.api_version or DEFAULT_DOCKER_API_VERSION
|
||||||
tls_hostname = host.get('tls_hostname') or def_tls_hostname or self._args.tls_hostname or \
|
tls_hostname = host.get('tls_hostname') or def_tls_hostname or self._args.tls_hostname or \
|
||||||
|
@ -816,7 +816,7 @@ class DockerInventory(object):
|
||||||
default_config = basename + '.yml'
|
default_config = basename + '.yml'
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Return Ansible inventory for one or more Docker hosts.')
|
description='Return Ansible inventory for one or more Docker hosts.')
|
||||||
parser.add_argument('--list', action='store_true', default=True,
|
parser.add_argument('--list', action='store_true', default=True,
|
||||||
help='List all containers (default: True)')
|
help='List all containers (default: True)')
|
||||||
parser.add_argument('--debug', action='store_true', default=False,
|
parser.add_argument('--debug', action='store_true', default=False,
|
||||||
|
|
|
@ -323,7 +323,7 @@ class GceInventory(object):
|
||||||
''' Command line argument processing '''
|
''' Command line argument processing '''
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Produce an Ansible Inventory file based on GCE')
|
description='Produce an Ansible Inventory file based on GCE')
|
||||||
parser.add_argument('--list', action='store_true', default=True,
|
parser.add_argument('--list', action='store_true', default=True,
|
||||||
help='List instances (default: True)')
|
help='List instances (default: True)')
|
||||||
parser.add_argument('--host', action='store',
|
parser.add_argument('--host', action='store',
|
||||||
|
|
|
@ -109,7 +109,7 @@ def print_host(host):
|
||||||
|
|
||||||
def get_args(args_list):
|
def get_args(args_list):
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='ansible inventory script parsing .ssh/config')
|
description='ansible inventory script parsing .ssh/config')
|
||||||
mutex_group = parser.add_mutually_exclusive_group(required=True)
|
mutex_group = parser.add_mutually_exclusive_group(required=True)
|
||||||
help_list = 'list all hosts from .ssh/config inventory'
|
help_list = 'list all hosts from .ssh/config inventory'
|
||||||
mutex_group.add_argument('--list', action='store_true', help=help_list)
|
mutex_group.add_argument('--list', action='store_true', help=help_list)
|
||||||
|
|
|
@ -230,17 +230,17 @@ htmlhelp_basename = 'Ansibledoc'
|
||||||
# -- Options for LaTeX output ---------------------------------------------
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
latex_elements = {
|
latex_elements = {
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
#'papersize': 'letterpaper',
|
#'papersize': 'letterpaper',
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
#'pointsize': '10pt',
|
#'pointsize': '10pt',
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
# Additional stuff for the LaTeX preamble.
|
||||||
#'preamble': '',
|
#'preamble': '',
|
||||||
|
|
||||||
# Latex figure (float) alignment
|
# Latex figure (float) alignment
|
||||||
#'figure_align': 'htbp',
|
#'figure_align': 'htbp',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
|
|
@ -203,7 +203,7 @@ htmlhelp_basename = 'Poseidodoc'
|
||||||
# (source start file, target name, title, author, document class
|
# (source start file, target name, title, author, document class
|
||||||
# [howto/manual]).
|
# [howto/manual]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
('index', 'ansible.tex', 'Ansible 2.2 Documentation', AUTHOR, 'manual'),
|
('index', 'ansible.tex', 'Ansible 2.2 Documentation', AUTHOR, 'manual'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
|
|
|
@ -203,7 +203,7 @@ htmlhelp_basename = 'Poseidodoc'
|
||||||
# (source start file, target name, title, author, document class
|
# (source start file, target name, title, author, document class
|
||||||
# [howto/manual]).
|
# [howto/manual]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
('index', 'ansible.tex', 'Ansible 1.2 Documentation',
|
('index', 'ansible.tex', 'Ansible 1.2 Documentation',
|
||||||
AUTHOR, 'manual'),
|
AUTHOR, 'manual'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -238,21 +238,21 @@ htmlhelp_basename = 'dev_guidedoc'
|
||||||
# -- Options for LaTeX output ---------------------------------------------
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
latex_elements = {
|
latex_elements = {
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
#
|
#
|
||||||
# 'papersize': 'letterpaper',
|
# 'papersize': 'letterpaper',
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
#
|
#
|
||||||
# 'pointsize': '10pt',
|
# 'pointsize': '10pt',
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
# Additional stuff for the LaTeX preamble.
|
||||||
#
|
#
|
||||||
# 'preamble': '',
|
# 'preamble': '',
|
||||||
|
|
||||||
# Latex figure (float) alignment
|
# Latex figure (float) alignment
|
||||||
#
|
#
|
||||||
# 'figure_align': 'htbp',
|
# 'figure_align': 'htbp',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
|
|
@ -48,11 +48,11 @@ def main():
|
||||||
|
|
||||||
# create play with tasks
|
# create play with tasks
|
||||||
play_source = dict(
|
play_source = dict(
|
||||||
name = "Ansible Play",
|
name = "Ansible Play",
|
||||||
hosts = host_list,
|
hosts = host_list,
|
||||||
gather_facts = 'no',
|
gather_facts = 'no',
|
||||||
tasks = [ dict(action=dict(module='command', args=dict(cmd='/usr/bin/uptime'))) ]
|
tasks = [ dict(action=dict(module='command', args=dict(cmd='/usr/bin/uptime'))) ]
|
||||||
)
|
)
|
||||||
play = Play().load(play_source, variable_manager=variable_manager, loader=loader)
|
play = Play().load(play_source, variable_manager=variable_manager, loader=loader)
|
||||||
|
|
||||||
# actually run it
|
# actually run it
|
||||||
|
@ -60,12 +60,12 @@ def main():
|
||||||
callback = ResultsCollector()
|
callback = ResultsCollector()
|
||||||
try:
|
try:
|
||||||
tqm = TaskQueueManager(
|
tqm = TaskQueueManager(
|
||||||
inventory=inventory,
|
inventory=inventory,
|
||||||
variable_manager=variable_manager,
|
variable_manager=variable_manager,
|
||||||
loader=loader,
|
loader=loader,
|
||||||
options=options,
|
options=options,
|
||||||
passwords=passwords,
|
passwords=passwords,
|
||||||
)
|
)
|
||||||
tqm._stdout_callback = callback
|
tqm._stdout_callback = callback
|
||||||
result = tqm.run(play)
|
result = tqm.run(play)
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -15,23 +15,23 @@ import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
filelist = [
|
filelist = [
|
||||||
'/etc/oracle-release',
|
'/etc/oracle-release',
|
||||||
'/etc/slackware-version',
|
'/etc/slackware-version',
|
||||||
'/etc/redhat-release',
|
'/etc/redhat-release',
|
||||||
'/etc/vmware-release',
|
'/etc/vmware-release',
|
||||||
'/etc/openwrt_release',
|
'/etc/openwrt_release',
|
||||||
'/etc/system-release',
|
'/etc/system-release',
|
||||||
'/etc/alpine-release',
|
'/etc/alpine-release',
|
||||||
'/etc/release',
|
'/etc/release',
|
||||||
'/etc/arch-release',
|
'/etc/arch-release',
|
||||||
'/etc/os-release',
|
'/etc/os-release',
|
||||||
'/etc/SuSE-release',
|
'/etc/SuSE-release',
|
||||||
'/etc/gentoo-release',
|
'/etc/gentoo-release',
|
||||||
'/etc/os-release',
|
'/etc/os-release',
|
||||||
'/etc/lsb-release',
|
'/etc/lsb-release',
|
||||||
'/etc/altlinux-release',
|
'/etc/altlinux-release',
|
||||||
'/etc/os-release',
|
'/etc/os-release',
|
||||||
'/etc/coreos/update.conf',
|
'/etc/coreos/update.conf',
|
||||||
]
|
]
|
||||||
|
|
||||||
fcont = {}
|
fcont = {}
|
||||||
|
|
|
@ -187,15 +187,15 @@ class AdHocCLI(CLI):
|
||||||
self._tqm = None
|
self._tqm = None
|
||||||
try:
|
try:
|
||||||
self._tqm = TaskQueueManager(
|
self._tqm = TaskQueueManager(
|
||||||
inventory=inventory,
|
inventory=inventory,
|
||||||
variable_manager=variable_manager,
|
variable_manager=variable_manager,
|
||||||
loader=loader,
|
loader=loader,
|
||||||
options=self.options,
|
options=self.options,
|
||||||
passwords=passwords,
|
passwords=passwords,
|
||||||
stdout_callback=cb,
|
stdout_callback=cb,
|
||||||
run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS,
|
run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS,
|
||||||
run_tree=run_tree,
|
run_tree=run_tree,
|
||||||
)
|
)
|
||||||
|
|
||||||
result = self._tqm.run(play)
|
result = self._tqm.run(play)
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -198,15 +198,15 @@ class ConsoleCLI(CLI, cmd.Cmd):
|
||||||
self._tqm = None
|
self._tqm = None
|
||||||
try:
|
try:
|
||||||
self._tqm = TaskQueueManager(
|
self._tqm = TaskQueueManager(
|
||||||
inventory=self.inventory,
|
inventory=self.inventory,
|
||||||
variable_manager=self.variable_manager,
|
variable_manager=self.variable_manager,
|
||||||
loader=self.loader,
|
loader=self.loader,
|
||||||
options=self.options,
|
options=self.options,
|
||||||
passwords=self.passwords,
|
passwords=self.passwords,
|
||||||
stdout_callback=cb,
|
stdout_callback=cb,
|
||||||
run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS,
|
run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS,
|
||||||
run_tree=False,
|
run_tree=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
result = self._tqm.run(play)
|
result = self._tqm.run(play)
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -42,7 +42,7 @@ if _system_six:
|
||||||
not hasattr(_system_six, 'byte2int') or
|
not hasattr(_system_six, 'byte2int') or
|
||||||
not hasattr(_system_six, 'add_metaclass') or
|
not hasattr(_system_six, 'add_metaclass') or
|
||||||
not hasattr(_system_six.moves, 'urllib')
|
not hasattr(_system_six.moves, 'urllib')
|
||||||
):
|
):
|
||||||
|
|
||||||
_system_six = False
|
_system_six = False
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ class PlayIterator:
|
||||||
setup_task.name = 'Gathering Facts'
|
setup_task.name = 'Gathering Facts'
|
||||||
setup_task.tags = ['always']
|
setup_task.tags = ['always']
|
||||||
setup_task.args = {
|
setup_task.args = {
|
||||||
'gather_subset': gather_subset,
|
'gather_subset': gather_subset,
|
||||||
}
|
}
|
||||||
if gather_timeout:
|
if gather_timeout:
|
||||||
setup_task.args['gather_timeout'] = gather_timeout
|
setup_task.args['gather_timeout'] = gather_timeout
|
||||||
|
|
|
@ -35,26 +35,26 @@ BOOLEANS = BOOLEANS_TRUE + BOOLEANS_FALSE
|
||||||
SIZE_RANGES = { 'Y': 1<<80, 'Z': 1<<70, 'E': 1<<60, 'P': 1<<50, 'T': 1<<40, 'G': 1<<30, 'M': 1<<20, 'K': 1<<10, 'B': 1 }
|
SIZE_RANGES = { 'Y': 1<<80, 'Z': 1<<70, 'E': 1<<60, 'P': 1<<50, 'T': 1<<40, 'G': 1<<30, 'M': 1<<20, 'K': 1<<10, 'B': 1 }
|
||||||
|
|
||||||
FILE_ATTRIBUTES = {
|
FILE_ATTRIBUTES = {
|
||||||
'A': 'noatime',
|
'A': 'noatime',
|
||||||
'a': 'append',
|
'a': 'append',
|
||||||
'c': 'compressed',
|
'c': 'compressed',
|
||||||
'C': 'nocow',
|
'C': 'nocow',
|
||||||
'd': 'nodump',
|
'd': 'nodump',
|
||||||
'D': 'dirsync',
|
'D': 'dirsync',
|
||||||
'e': 'extents',
|
'e': 'extents',
|
||||||
'E': 'encrypted',
|
'E': 'encrypted',
|
||||||
'h': 'blocksize',
|
'h': 'blocksize',
|
||||||
'i': 'immutable',
|
'i': 'immutable',
|
||||||
'I': 'indexed',
|
'I': 'indexed',
|
||||||
'j': 'journalled',
|
'j': 'journalled',
|
||||||
'N': 'inline',
|
'N': 'inline',
|
||||||
's': 'zero',
|
's': 'zero',
|
||||||
'S': 'synchronous',
|
'S': 'synchronous',
|
||||||
't': 'notail',
|
't': 'notail',
|
||||||
'T': 'blockroot',
|
'T': 'blockroot',
|
||||||
'u': 'undelete',
|
'u': 'undelete',
|
||||||
'X': 'compressedraw',
|
'X': 'compressedraw',
|
||||||
'Z': 'compresseddirty',
|
'Z': 'compresseddirty',
|
||||||
}
|
}
|
||||||
|
|
||||||
# ansible modules can be written in any language. To simplify
|
# ansible modules can be written in any language. To simplify
|
||||||
|
@ -728,19 +728,19 @@ class AnsibleModule(object):
|
||||||
self._set_defaults(pre=True)
|
self._set_defaults(pre=True)
|
||||||
|
|
||||||
self._CHECK_ARGUMENT_TYPES_DISPATCHER = {
|
self._CHECK_ARGUMENT_TYPES_DISPATCHER = {
|
||||||
'str': self._check_type_str,
|
'str': self._check_type_str,
|
||||||
'list': self._check_type_list,
|
'list': self._check_type_list,
|
||||||
'dict': self._check_type_dict,
|
'dict': self._check_type_dict,
|
||||||
'bool': self._check_type_bool,
|
'bool': self._check_type_bool,
|
||||||
'int': self._check_type_int,
|
'int': self._check_type_int,
|
||||||
'float': self._check_type_float,
|
'float': self._check_type_float,
|
||||||
'path': self._check_type_path,
|
'path': self._check_type_path,
|
||||||
'raw': self._check_type_raw,
|
'raw': self._check_type_raw,
|
||||||
'jsonarg': self._check_type_jsonarg,
|
'jsonarg': self._check_type_jsonarg,
|
||||||
'json': self._check_type_jsonarg,
|
'json': self._check_type_jsonarg,
|
||||||
'bytes': self._check_type_bytes,
|
'bytes': self._check_type_bytes,
|
||||||
'bits': self._check_type_bits,
|
'bits': self._check_type_bits,
|
||||||
}
|
}
|
||||||
if not bypass_checks:
|
if not bypass_checks:
|
||||||
self._check_required_arguments()
|
self._check_required_arguments()
|
||||||
self._check_argument_types()
|
self._check_argument_types()
|
||||||
|
|
|
@ -1078,22 +1078,22 @@ class LinuxHardware(Hardware):
|
||||||
memstats['swap:used'] = memstats['swaptotal'] - memstats['swapfree']
|
memstats['swap:used'] = memstats['swaptotal'] - memstats['swapfree']
|
||||||
|
|
||||||
self.facts['memory_mb'] = {
|
self.facts['memory_mb'] = {
|
||||||
'real' : {
|
'real' : {
|
||||||
'total': memstats.get('memtotal'),
|
'total': memstats.get('memtotal'),
|
||||||
'used': memstats.get('real:used'),
|
'used': memstats.get('real:used'),
|
||||||
'free': memstats.get('memfree'),
|
'free': memstats.get('memfree'),
|
||||||
},
|
},
|
||||||
'nocache' : {
|
'nocache' : {
|
||||||
'free': memstats.get('nocache:free'),
|
'free': memstats.get('nocache:free'),
|
||||||
'used': memstats.get('nocache:used'),
|
'used': memstats.get('nocache:used'),
|
||||||
},
|
},
|
||||||
'swap' : {
|
'swap' : {
|
||||||
'total': memstats.get('swaptotal'),
|
'total': memstats.get('swaptotal'),
|
||||||
'free': memstats.get('swapfree'),
|
'free': memstats.get('swapfree'),
|
||||||
'used': memstats.get('swap:used'),
|
'used': memstats.get('swap:used'),
|
||||||
'cached': memstats.get('swapcached'),
|
'cached': memstats.get('swapcached'),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_cpu_facts(self):
|
def get_cpu_facts(self):
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -1212,15 +1212,15 @@ class LinuxHardware(Hardware):
|
||||||
"CompactPCI", "AdvancedTCA", "Blade" ]
|
"CompactPCI", "AdvancedTCA", "Blade" ]
|
||||||
|
|
||||||
DMI_DICT = {
|
DMI_DICT = {
|
||||||
'bios_date': '/sys/devices/virtual/dmi/id/bios_date',
|
'bios_date': '/sys/devices/virtual/dmi/id/bios_date',
|
||||||
'bios_version': '/sys/devices/virtual/dmi/id/bios_version',
|
'bios_version': '/sys/devices/virtual/dmi/id/bios_version',
|
||||||
'form_factor': '/sys/devices/virtual/dmi/id/chassis_type',
|
'form_factor': '/sys/devices/virtual/dmi/id/chassis_type',
|
||||||
'product_name': '/sys/devices/virtual/dmi/id/product_name',
|
'product_name': '/sys/devices/virtual/dmi/id/product_name',
|
||||||
'product_serial': '/sys/devices/virtual/dmi/id/product_serial',
|
'product_serial': '/sys/devices/virtual/dmi/id/product_serial',
|
||||||
'product_uuid': '/sys/devices/virtual/dmi/id/product_uuid',
|
'product_uuid': '/sys/devices/virtual/dmi/id/product_uuid',
|
||||||
'product_version': '/sys/devices/virtual/dmi/id/product_version',
|
'product_version': '/sys/devices/virtual/dmi/id/product_version',
|
||||||
'system_vendor': '/sys/devices/virtual/dmi/id/sys_vendor'
|
'system_vendor': '/sys/devices/virtual/dmi/id/sys_vendor'
|
||||||
}
|
}
|
||||||
|
|
||||||
for (key,path) in DMI_DICT.items():
|
for (key,path) in DMI_DICT.items():
|
||||||
data = get_file_content(path)
|
data = get_file_content(path)
|
||||||
|
@ -1239,15 +1239,15 @@ class LinuxHardware(Hardware):
|
||||||
# Fall back to using dmidecode, if available
|
# Fall back to using dmidecode, if available
|
||||||
dmi_bin = self.module.get_bin_path('dmidecode')
|
dmi_bin = self.module.get_bin_path('dmidecode')
|
||||||
DMI_DICT = {
|
DMI_DICT = {
|
||||||
'bios_date': 'bios-release-date',
|
'bios_date': 'bios-release-date',
|
||||||
'bios_version': 'bios-version',
|
'bios_version': 'bios-version',
|
||||||
'form_factor': 'chassis-type',
|
'form_factor': 'chassis-type',
|
||||||
'product_name': 'system-product-name',
|
'product_name': 'system-product-name',
|
||||||
'product_serial': 'system-serial-number',
|
'product_serial': 'system-serial-number',
|
||||||
'product_uuid': 'system-uuid',
|
'product_uuid': 'system-uuid',
|
||||||
'product_version': 'system-version',
|
'product_version': 'system-version',
|
||||||
'system_vendor': 'system-manufacturer'
|
'system_vendor': 'system-manufacturer'
|
||||||
}
|
}
|
||||||
for (k, v) in DMI_DICT.items():
|
for (k, v) in DMI_DICT.items():
|
||||||
if dmi_bin is not None:
|
if dmi_bin is not None:
|
||||||
(rc, out, err) = self.module.run_command('%s -s %s' % (dmi_bin, v))
|
(rc, out, err) = self.module.run_command('%s -s %s' % (dmi_bin, v))
|
||||||
|
|
|
@ -77,7 +77,7 @@ def _get_gcp_ansible_credentials(module):
|
||||||
def _get_gcp_environ_var(var_name, default_value):
|
def _get_gcp_environ_var(var_name, default_value):
|
||||||
"""Wrapper around os.environ.get call."""
|
"""Wrapper around os.environ.get call."""
|
||||||
return os.environ.get(
|
return os.environ.get(
|
||||||
var_name, default_value)
|
var_name, default_value)
|
||||||
|
|
||||||
def _get_gcp_environment_credentials(service_account_email, credentials_file, project_id):
|
def _get_gcp_environment_credentials(service_account_email, credentials_file, project_id):
|
||||||
"""Helper to look in environment variables for credentials."""
|
"""Helper to look in environment variables for credentials."""
|
||||||
|
@ -315,7 +315,7 @@ def get_google_cloud_credentials(module, scopes=[]):
|
||||||
credentials = credentials.with_scopes(scopes)
|
credentials = credentials.with_scopes(scopes)
|
||||||
else:
|
else:
|
||||||
credentials = google.auth.default(
|
credentials = google.auth.default(
|
||||||
scopes=scopes)[0]
|
scopes=scopes)[0]
|
||||||
|
|
||||||
return (credentials, conn_params)
|
return (credentials, conn_params)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -103,7 +103,7 @@ class Nxapi(NxapiConfigMixin):
|
||||||
command_type = self.OUTPUT_TO_COMMAND_TYPE[output]
|
command_type = self.OUTPUT_TO_COMMAND_TYPE[output]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
msg = 'invalid format, received %s, expected one of %s' % \
|
msg = 'invalid format, received %s, expected one of %s' % \
|
||||||
(output, ','.join(self.OUTPUT_TO_COMMAND_TYPE.keys()))
|
(output, ','.join(self.OUTPUT_TO_COMMAND_TYPE.keys()))
|
||||||
self._error(msg=msg)
|
self._error(msg=msg)
|
||||||
|
|
||||||
if isinstance(commands, (list, set, tuple)):
|
if isinstance(commands, (list, set, tuple)):
|
||||||
|
|
|
@ -141,7 +141,7 @@ class Rhsm(RegistrationBase):
|
||||||
# Quick version...
|
# Quick version...
|
||||||
if False:
|
if False:
|
||||||
return os.path.isfile('/etc/pki/consumer/cert.pem') and \
|
return os.path.isfile('/etc/pki/consumer/cert.pem') and \
|
||||||
os.path.isfile('/etc/pki/consumer/key.pem')
|
os.path.isfile('/etc/pki/consumer/key.pem')
|
||||||
|
|
||||||
args = ['subscription-manager', 'identity']
|
args = ['subscription-manager', 'identity']
|
||||||
rc, stdout, stderr = self.module.run_command(args, check_rc=False)
|
rc, stdout, stderr = self.module.run_command(args, check_rc=False)
|
||||||
|
|
|
@ -698,19 +698,19 @@ def terminate_vpc(module, vpc_conn, vpc_id=None, cidr=None):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
cidr_block = dict(),
|
cidr_block = dict(),
|
||||||
instance_tenancy = dict(choices=['default', 'dedicated'], default='default'),
|
instance_tenancy = dict(choices=['default', 'dedicated'], default='default'),
|
||||||
wait = dict(type='bool', default=False),
|
wait = dict(type='bool', default=False),
|
||||||
wait_timeout = dict(default=300),
|
wait_timeout = dict(default=300),
|
||||||
dns_support = dict(type='bool', default=True),
|
dns_support = dict(type='bool', default=True),
|
||||||
dns_hostnames = dict(type='bool', default=True),
|
dns_hostnames = dict(type='bool', default=True),
|
||||||
subnets = dict(type='list'),
|
subnets = dict(type='list'),
|
||||||
vpc_id = dict(),
|
vpc_id = dict(),
|
||||||
internet_gateway = dict(type='bool', default=False),
|
internet_gateway = dict(type='bool', default=False),
|
||||||
resource_tags = dict(type='dict', required=True),
|
resource_tags = dict(type='dict', required=True),
|
||||||
route_tables = dict(type='list'),
|
route_tables = dict(type='list'),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state = dict(choices=['present', 'absent'], default='present'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
ANSIBLE_METADATA = {
|
ANSIBLE_METADATA = {
|
||||||
'version': '1.0',
|
'version': '1.0',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'committer'
|
'supported_by': 'committer'
|
||||||
}
|
}
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
|
@ -236,14 +236,14 @@ def assert_policy_shape(policy):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ansible.module_utils.ec2.ec2_argument_spec()
|
argument_spec = ansible.module_utils.ec2.ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
mode = dict(choices=['grant', 'deny'], default='grant'),
|
mode = dict(choices=['grant', 'deny'], default='grant'),
|
||||||
key_alias = dict(required=False, type='str'),
|
key_alias = dict(required=False, type='str'),
|
||||||
key_arn = dict(required=False, type='str'),
|
key_arn = dict(required=False, type='str'),
|
||||||
role_name = dict(required=False, type='str'),
|
role_name = dict(required=False, type='str'),
|
||||||
role_arn = dict(required=False, type='str'),
|
role_arn = dict(required=False, type='str'),
|
||||||
grant_types = dict(required=False, type='list'),
|
grant_types = dict(required=False, type='list'),
|
||||||
clean_invalid_entries = dict(type='bool', default=True),
|
clean_invalid_entries = dict(type='bool', default=True),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -390,18 +390,18 @@ def get_stack_facts(cfn, stack_name):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ansible.module_utils.ec2.ec2_argument_spec()
|
argument_spec = ansible.module_utils.ec2.ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
stack_name=dict(required=True),
|
stack_name=dict(required=True),
|
||||||
template_parameters=dict(required=False, type='dict', default={}),
|
template_parameters=dict(required=False, type='dict', default={}),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
template=dict(default=None, required=False, type='path'),
|
template=dict(default=None, required=False, type='path'),
|
||||||
notification_arns=dict(default=None, required=False),
|
notification_arns=dict(default=None, required=False),
|
||||||
stack_policy=dict(default=None, required=False),
|
stack_policy=dict(default=None, required=False),
|
||||||
disable_rollback=dict(default=False, type='bool'),
|
disable_rollback=dict(default=False, type='bool'),
|
||||||
template_url=dict(default=None, required=False),
|
template_url=dict(default=None, required=False),
|
||||||
template_format=dict(default=None, choices=['json', 'yaml'], required=False),
|
template_format=dict(default=None, choices=['json', 'yaml'], required=False),
|
||||||
role_arn=dict(default=None, required=False),
|
role_arn=dict(default=None, required=False),
|
||||||
tags=dict(default=None, type='dict')
|
tags=dict(default=None, type='dict')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -413,7 +413,7 @@ def main():
|
||||||
|
|
||||||
# collect the parameters that are passed to boto3. Keeps us from having so many scalars floating around.
|
# collect the parameters that are passed to boto3. Keeps us from having so many scalars floating around.
|
||||||
stack_params = {
|
stack_params = {
|
||||||
'Capabilities': ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'],
|
'Capabilities': ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'],
|
||||||
}
|
}
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
stack_params['StackName'] = module.params['stack_name']
|
stack_params['StackName'] = module.params['stack_name']
|
||||||
|
|
|
@ -1135,18 +1135,18 @@ def create_instances(module, ec2, vpc, override_count=None):
|
||||||
if not spot_price:
|
if not spot_price:
|
||||||
if assign_public_ip and private_ip:
|
if assign_public_ip and private_ip:
|
||||||
params.update(dict(
|
params.update(dict(
|
||||||
min_count = count_remaining,
|
min_count = count_remaining,
|
||||||
max_count = count_remaining,
|
max_count = count_remaining,
|
||||||
client_token = id,
|
client_token = id,
|
||||||
placement_group = placement_group,
|
placement_group = placement_group,
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
params.update(dict(
|
params.update(dict(
|
||||||
min_count = count_remaining,
|
min_count = count_remaining,
|
||||||
max_count = count_remaining,
|
max_count = count_remaining,
|
||||||
client_token = id,
|
client_token = id,
|
||||||
placement_group = placement_group,
|
placement_group = placement_group,
|
||||||
private_ip_address = private_ip,
|
private_ip_address = private_ip,
|
||||||
))
|
))
|
||||||
|
|
||||||
# For ordinary (not spot) instances, we can select 'stop'
|
# For ordinary (not spot) instances, we can select 'stop'
|
||||||
|
@ -1537,56 +1537,56 @@ def restart_instances(module, ec2, instance_ids, state, instance_tags):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
key_name = dict(aliases = ['keypair']),
|
key_name = dict(aliases = ['keypair']),
|
||||||
id = dict(),
|
id = dict(),
|
||||||
group = dict(type='list', aliases=['groups']),
|
group = dict(type='list', aliases=['groups']),
|
||||||
group_id = dict(type='list'),
|
group_id = dict(type='list'),
|
||||||
zone = dict(aliases=['aws_zone', 'ec2_zone']),
|
zone = dict(aliases=['aws_zone', 'ec2_zone']),
|
||||||
instance_type = dict(aliases=['type']),
|
instance_type = dict(aliases=['type']),
|
||||||
spot_price = dict(),
|
spot_price = dict(),
|
||||||
spot_type = dict(default='one-time', choices=["one-time", "persistent"]),
|
spot_type = dict(default='one-time', choices=["one-time", "persistent"]),
|
||||||
spot_launch_group = dict(),
|
spot_launch_group = dict(),
|
||||||
image = dict(),
|
image = dict(),
|
||||||
kernel = dict(),
|
kernel = dict(),
|
||||||
count = dict(type='int', default='1'),
|
count = dict(type='int', default='1'),
|
||||||
monitoring = dict(type='bool', default=False),
|
monitoring = dict(type='bool', default=False),
|
||||||
ramdisk = dict(),
|
ramdisk = dict(),
|
||||||
wait = dict(type='bool', default=False),
|
wait = dict(type='bool', default=False),
|
||||||
wait_timeout = dict(default=300),
|
wait_timeout = dict(default=300),
|
||||||
spot_wait_timeout = dict(default=600),
|
spot_wait_timeout = dict(default=600),
|
||||||
placement_group = dict(),
|
placement_group = dict(),
|
||||||
user_data = dict(),
|
user_data = dict(),
|
||||||
instance_tags = dict(type='dict'),
|
instance_tags = dict(type='dict'),
|
||||||
vpc_subnet_id = dict(),
|
vpc_subnet_id = dict(),
|
||||||
assign_public_ip = dict(type='bool', default=False),
|
assign_public_ip = dict(type='bool', default=False),
|
||||||
private_ip = dict(),
|
private_ip = dict(),
|
||||||
instance_profile_name = dict(),
|
instance_profile_name = dict(),
|
||||||
instance_ids = dict(type='list', aliases=['instance_id']),
|
instance_ids = dict(type='list', aliases=['instance_id']),
|
||||||
source_dest_check = dict(type='bool', default=True),
|
source_dest_check = dict(type='bool', default=True),
|
||||||
termination_protection = dict(type='bool', default=None),
|
termination_protection = dict(type='bool', default=None),
|
||||||
state = dict(default='present', choices=['present', 'absent', 'running', 'restarted', 'stopped']),
|
state = dict(default='present', choices=['present', 'absent', 'running', 'restarted', 'stopped']),
|
||||||
instance_initiated_shutdown_behavior=dict(default=None, choices=['stop', 'terminate']),
|
instance_initiated_shutdown_behavior=dict(default=None, choices=['stop', 'terminate']),
|
||||||
exact_count = dict(type='int', default=None),
|
exact_count = dict(type='int', default=None),
|
||||||
count_tag = dict(),
|
count_tag = dict(),
|
||||||
volumes = dict(type='list'),
|
volumes = dict(type='list'),
|
||||||
ebs_optimized = dict(type='bool', default=False),
|
ebs_optimized = dict(type='bool', default=False),
|
||||||
tenancy = dict(default='default'),
|
tenancy = dict(default='default'),
|
||||||
network_interfaces = dict(type='list', aliases=['network_interface'])
|
network_interfaces = dict(type='list', aliases=['network_interface'])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
mutually_exclusive = [
|
mutually_exclusive = [
|
||||||
['exact_count', 'count'],
|
['exact_count', 'count'],
|
||||||
['exact_count', 'state'],
|
['exact_count', 'state'],
|
||||||
['exact_count', 'instance_ids'],
|
['exact_count', 'instance_ids'],
|
||||||
['network_interfaces', 'assign_public_ip'],
|
['network_interfaces', 'assign_public_ip'],
|
||||||
['network_interfaces', 'group'],
|
['network_interfaces', 'group'],
|
||||||
['network_interfaces', 'group_id'],
|
['network_interfaces', 'group_id'],
|
||||||
['network_interfaces', 'private_ip'],
|
['network_interfaces', 'private_ip'],
|
||||||
['network_interfaces', 'vpc_subnet_id'],
|
['network_interfaces', 'vpc_subnet_id'],
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_BOTO:
|
if not HAS_BOTO:
|
||||||
|
|
|
@ -584,23 +584,23 @@ def update_image(module, ec2, image_id):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
instance_id = dict(),
|
instance_id = dict(),
|
||||||
image_id = dict(),
|
image_id = dict(),
|
||||||
architecture = dict(default="x86_64"),
|
architecture = dict(default="x86_64"),
|
||||||
kernel_id = dict(),
|
kernel_id = dict(),
|
||||||
virtualization_type = dict(default="hvm"),
|
virtualization_type = dict(default="hvm"),
|
||||||
root_device_name = dict(),
|
root_device_name = dict(),
|
||||||
delete_snapshot = dict(default=False, type='bool'),
|
delete_snapshot = dict(default=False, type='bool'),
|
||||||
name = dict(),
|
name = dict(),
|
||||||
wait = dict(type='bool', default=False),
|
wait = dict(type='bool', default=False),
|
||||||
wait_timeout = dict(default=900),
|
wait_timeout = dict(default=900),
|
||||||
description = dict(default=""),
|
description = dict(default=""),
|
||||||
no_reboot = dict(default=False, type='bool'),
|
no_reboot = dict(default=False, type='bool'),
|
||||||
state = dict(default='present'),
|
state = dict(default='present'),
|
||||||
device_mapping = dict(type='list'),
|
device_mapping = dict(type='list'),
|
||||||
tags = dict(type='dict'),
|
tags = dict(type='dict'),
|
||||||
launch_permissions = dict(type='dict')
|
launch_permissions = dict(type='dict')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -173,9 +173,9 @@ def copy_image(module, ec2):
|
||||||
ec2.get_waiter('image_available').wait(ImageIds=[image_id])
|
ec2.get_waiter('image_available').wait(ImageIds=[image_id])
|
||||||
if module.params.get('tags'):
|
if module.params.get('tags'):
|
||||||
ec2.create_tags(
|
ec2.create_tags(
|
||||||
Resources=[image_id],
|
Resources=[image_id],
|
||||||
Tags=[{'Key' : k, 'Value': v} for k,v in module.params.get('tags').items()]
|
Tags=[{'Key' : k, 'Value': v} for k,v in module.params.get('tags').items()]
|
||||||
)
|
)
|
||||||
|
|
||||||
module.exit_json(changed=True, image_id=image_id)
|
module.exit_json(changed=True, image_id=image_id)
|
||||||
except WaiterError as we:
|
except WaiterError as we:
|
||||||
|
|
|
@ -298,27 +298,27 @@ def get_block_device_mapping(image):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
owner = dict(required=False, default=None),
|
owner = dict(required=False, default=None),
|
||||||
ami_id = dict(required=False),
|
ami_id = dict(required=False),
|
||||||
ami_tags = dict(required=False, type='dict',
|
ami_tags = dict(required=False, type='dict',
|
||||||
aliases = ['search_tags', 'image_tags']),
|
aliases = ['search_tags', 'image_tags']),
|
||||||
architecture = dict(required=False),
|
architecture = dict(required=False),
|
||||||
hypervisor = dict(required=False),
|
hypervisor = dict(required=False),
|
||||||
is_public = dict(required=False, type='bool'),
|
is_public = dict(required=False, type='bool'),
|
||||||
name = dict(required=False),
|
name = dict(required=False),
|
||||||
platform = dict(required=False),
|
platform = dict(required=False),
|
||||||
sort = dict(required=False, default=None,
|
sort = dict(required=False, default=None,
|
||||||
choices=['name', 'description', 'tag', 'architecture', 'block_device_mapping', 'creationDate', 'hypervisor', 'is_public', 'location', 'owner_id', 'platform', 'root_device_name', 'root_device_type', 'state', 'virtualization_type']),
|
choices=['name', 'description', 'tag', 'architecture', 'block_device_mapping', 'creationDate', 'hypervisor', 'is_public', 'location', 'owner_id', 'platform', 'root_device_name', 'root_device_type', 'state', 'virtualization_type']),
|
||||||
sort_tag = dict(required=False),
|
sort_tag = dict(required=False),
|
||||||
sort_order = dict(required=False, default='ascending',
|
sort_order = dict(required=False, default='ascending',
|
||||||
choices=['ascending', 'descending']),
|
choices=['ascending', 'descending']),
|
||||||
sort_start = dict(required=False),
|
sort_start = dict(required=False),
|
||||||
sort_end = dict(required=False),
|
sort_end = dict(required=False),
|
||||||
state = dict(required=False, default='available'),
|
state = dict(required=False, default='available'),
|
||||||
virtualization_type = dict(required=False),
|
virtualization_type = dict(required=False),
|
||||||
no_result_action = dict(required=False, default='success',
|
no_result_action = dict(required=False, default='success',
|
||||||
choices = ['success', 'fail']),
|
choices = ['success', 'fail']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -473,21 +473,21 @@ def create_autoscaling_group(connection, module):
|
||||||
if len(launch_configs) == 0:
|
if len(launch_configs) == 0:
|
||||||
module.fail_json(msg="No launch config found with name %s" % launch_config_name)
|
module.fail_json(msg="No launch config found with name %s" % launch_config_name)
|
||||||
ag = AutoScalingGroup(
|
ag = AutoScalingGroup(
|
||||||
group_name=group_name,
|
group_name=group_name,
|
||||||
load_balancers=load_balancers,
|
load_balancers=load_balancers,
|
||||||
availability_zones=availability_zones,
|
availability_zones=availability_zones,
|
||||||
launch_config=launch_configs[0],
|
launch_config=launch_configs[0],
|
||||||
min_size=min_size,
|
min_size=min_size,
|
||||||
max_size=max_size,
|
max_size=max_size,
|
||||||
placement_group=placement_group,
|
placement_group=placement_group,
|
||||||
desired_capacity=desired_capacity,
|
desired_capacity=desired_capacity,
|
||||||
vpc_zone_identifier=vpc_zone_identifier,
|
vpc_zone_identifier=vpc_zone_identifier,
|
||||||
connection=connection,
|
connection=connection,
|
||||||
tags=asg_tags,
|
tags=asg_tags,
|
||||||
health_check_period=health_check_period,
|
health_check_period=health_check_period,
|
||||||
health_check_type=health_check_type,
|
health_check_type=health_check_type,
|
||||||
default_cooldown=default_cooldown,
|
default_cooldown=default_cooldown,
|
||||||
termination_policies=termination_policies)
|
termination_policies=termination_policies)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection.create_auto_scaling_group(ag)
|
connection.create_auto_scaling_group(ag)
|
||||||
|
|
|
@ -326,13 +326,13 @@ class ElbManager:
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
state={'required': True},
|
state={'required': True},
|
||||||
instance_id={'required': True},
|
instance_id={'required': True},
|
||||||
ec2_elbs={'default': None, 'required': False, 'type':'list'},
|
ec2_elbs={'default': None, 'required': False, 'type':'list'},
|
||||||
enable_availability_zone={'default': True, 'required': False, 'type': 'bool'},
|
enable_availability_zone={'default': True, 'required': False, 'type': 'bool'},
|
||||||
wait={'required': False, 'default': True, 'type': 'bool'},
|
wait={'required': False, 'default': True, 'type': 'bool'},
|
||||||
wait_timeout={'required': False, 'default': 0, 'type': 'int'}
|
wait_timeout={'required': False, 'default': 0, 'type': 'int'}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -195,8 +195,8 @@ class ElbInformation(object):
|
||||||
elb_info['instances_outofservice'] = [inst.instance_id for inst in instance_health if inst.state == 'OutOfService']
|
elb_info['instances_outofservice'] = [inst.instance_id for inst in instance_health if inst.state == 'OutOfService']
|
||||||
elb_info['instances_outofservice_count'] = len(elb_info['instances_outofservice'])
|
elb_info['instances_outofservice_count'] = len(elb_info['instances_outofservice'])
|
||||||
elb_info['instances_inservice_percent'] = float(elb_info['instances_inservice_count'])/(
|
elb_info['instances_inservice_percent'] = float(elb_info['instances_inservice_count'])/(
|
||||||
float(elb_info['instances_inservice_count']) +
|
float(elb_info['instances_inservice_count']) +
|
||||||
float(elb_info['instances_outofservice_count']))*100
|
float(elb_info['instances_outofservice_count']))*100
|
||||||
return elb_info
|
return elb_info
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,8 +221,8 @@ class ElbInformation(object):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
names={'default': [], 'type': 'list'}
|
names={'default': [], 'type': 'list'}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec,
|
module = AnsibleModule(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
|
@ -650,7 +650,7 @@ class ElbManager(object):
|
||||||
status_achieved = False
|
status_achieved = False
|
||||||
|
|
||||||
elb_interfaces = self.ec2_conn.get_all_network_interfaces(
|
elb_interfaces = self.ec2_conn.get_all_network_interfaces(
|
||||||
filters={'attachment.instance-owner-id': 'amazon-elb',
|
filters={'attachment.instance-owner-id': 'amazon-elb',
|
||||||
'description': 'ELB {0}'.format(self.name) })
|
'description': 'ELB {0}'.format(self.name) })
|
||||||
|
|
||||||
for x in range(0, max_retries):
|
for x in range(0, max_retries):
|
||||||
|
@ -1227,29 +1227,29 @@ class ElbManager(object):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
state={'required': True, 'choices': ['present', 'absent']},
|
state={'required': True, 'choices': ['present', 'absent']},
|
||||||
name={'required': True},
|
name={'required': True},
|
||||||
listeners={'default': None, 'required': False, 'type': 'list'},
|
listeners={'default': None, 'required': False, 'type': 'list'},
|
||||||
purge_listeners={'default': True, 'required': False, 'type': 'bool'},
|
purge_listeners={'default': True, 'required': False, 'type': 'bool'},
|
||||||
instance_ids={'default': None, 'required': False, 'type': 'list'},
|
instance_ids={'default': None, 'required': False, 'type': 'list'},
|
||||||
purge_instance_ids={'default': False, 'required': False, 'type': 'bool'},
|
purge_instance_ids={'default': False, 'required': False, 'type': 'bool'},
|
||||||
zones={'default': None, 'required': False, 'type': 'list'},
|
zones={'default': None, 'required': False, 'type': 'list'},
|
||||||
purge_zones={'default': False, 'required': False, 'type': 'bool'},
|
purge_zones={'default': False, 'required': False, 'type': 'bool'},
|
||||||
security_group_ids={'default': None, 'required': False, 'type': 'list'},
|
security_group_ids={'default': None, 'required': False, 'type': 'list'},
|
||||||
security_group_names={'default': None, 'required': False, 'type': 'list'},
|
security_group_names={'default': None, 'required': False, 'type': 'list'},
|
||||||
health_check={'default': None, 'required': False, 'type': 'dict'},
|
health_check={'default': None, 'required': False, 'type': 'dict'},
|
||||||
subnets={'default': None, 'required': False, 'type': 'list'},
|
subnets={'default': None, 'required': False, 'type': 'list'},
|
||||||
purge_subnets={'default': False, 'required': False, 'type': 'bool'},
|
purge_subnets={'default': False, 'required': False, 'type': 'bool'},
|
||||||
scheme={'default': 'internet-facing', 'required': False},
|
scheme={'default': 'internet-facing', 'required': False},
|
||||||
connection_draining_timeout={'default': None, 'required': False},
|
connection_draining_timeout={'default': None, 'required': False},
|
||||||
idle_timeout={'default': None, 'required': False},
|
idle_timeout={'default': None, 'required': False},
|
||||||
cross_az_load_balancing={'default': None, 'required': False},
|
cross_az_load_balancing={'default': None, 'required': False},
|
||||||
stickiness={'default': None, 'required': False, 'type': 'dict'},
|
stickiness={'default': None, 'required': False, 'type': 'dict'},
|
||||||
access_logs={'default': None, 'required': False, 'type': 'dict'},
|
access_logs={'default': None, 'required': False, 'type': 'dict'},
|
||||||
wait={'default': False, 'type': 'bool', 'required': False},
|
wait={'default': False, 'type': 'bool', 'required': False},
|
||||||
wait_timeout={'default': 60, 'type': 'int', 'required': False},
|
wait_timeout={'default': 60, 'type': 'int', 'required': False},
|
||||||
tags={'default': None, 'required': False, 'type': 'dict'}
|
tags={'default': None, 'required': False, 'type': 'dict'}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -532,12 +532,12 @@ def main():
|
||||||
module = AnsibleModule(argument_spec=argument_spec,
|
module = AnsibleModule(argument_spec=argument_spec,
|
||||||
mutually_exclusive=[
|
mutually_exclusive=[
|
||||||
['secondary_private_ip_addresses', 'secondary_private_ip_address_count']
|
['secondary_private_ip_addresses', 'secondary_private_ip_address_count']
|
||||||
],
|
],
|
||||||
required_if=([
|
required_if=([
|
||||||
('state', 'present', ['subnet_id']),
|
('state', 'present', ['subnet_id']),
|
||||||
('state', 'absent', ['eni_id']),
|
('state', 'absent', ['eni_id']),
|
||||||
('attached', True, ['instance_id'])
|
('attached', True, ['instance_id'])
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_BOTO:
|
if not HAS_BOTO:
|
||||||
|
|
|
@ -176,8 +176,8 @@ def main():
|
||||||
argument_spec = url_argument_spec()
|
argument_spec = url_argument_spec()
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
ec2_facts = Ec2Metadata(module).run()
|
ec2_facts = Ec2Metadata(module).run()
|
||||||
|
|
|
@ -241,16 +241,16 @@ def get_target_from_rule(module, ec2, rule, name, group, groups, vpc_id):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
name=dict(type='str', required=True),
|
name=dict(type='str', required=True),
|
||||||
description=dict(type='str', required=True),
|
description=dict(type='str', required=True),
|
||||||
vpc_id=dict(type='str'),
|
vpc_id=dict(type='str'),
|
||||||
rules=dict(type='list'),
|
rules=dict(type='list'),
|
||||||
rules_egress=dict(type='list'),
|
rules_egress=dict(type='list'),
|
||||||
state = dict(default='present', type='str', choices=['present', 'absent']),
|
state = dict(default='present', type='str', choices=['present', 'absent']),
|
||||||
purge_rules=dict(default=True, required=False, type='bool'),
|
purge_rules=dict(default=True, required=False, type='bool'),
|
||||||
purge_rules_egress=dict(default=True, required=False, type='bool'),
|
purge_rules_egress=dict(default=True, required=False, type='bool'),
|
||||||
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
|
@ -427,12 +427,12 @@ def main():
|
||||||
|
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
ec2.authorize_security_group_egress(
|
ec2.authorize_security_group_egress(
|
||||||
group_id=group.id,
|
group_id=group.id,
|
||||||
ip_protocol=rule['proto'],
|
ip_protocol=rule['proto'],
|
||||||
from_port=rule['from_port'],
|
from_port=rule['from_port'],
|
||||||
to_port=rule['to_port'],
|
to_port=rule['to_port'],
|
||||||
src_group_id=grantGroup,
|
src_group_id=grantGroup,
|
||||||
cidr_ip=thisip)
|
cidr_ip=thisip)
|
||||||
changed = True
|
changed = True
|
||||||
elif vpc_id:
|
elif vpc_id:
|
||||||
# when using a vpc, but no egress rules are specified,
|
# when using a vpc, but no egress rules are specified,
|
||||||
|
@ -462,12 +462,12 @@ def main():
|
||||||
grantGroup = groups[grant.group_id].id
|
grantGroup = groups[grant.group_id].id
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
ec2.revoke_security_group_egress(
|
ec2.revoke_security_group_egress(
|
||||||
group_id=group.id,
|
group_id=group.id,
|
||||||
ip_protocol=rule.ip_protocol,
|
ip_protocol=rule.ip_protocol,
|
||||||
from_port=rule.from_port,
|
from_port=rule.from_port,
|
||||||
to_port=rule.to_port,
|
to_port=rule.to_port,
|
||||||
src_group_id=grantGroup,
|
src_group_id=grantGroup,
|
||||||
cidr_ip=grant.cidr_ip)
|
cidr_ip=grant.cidr_ip)
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
if group:
|
if group:
|
||||||
|
|
|
@ -108,12 +108,12 @@ import string
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
name=dict(required=True),
|
name=dict(required=True),
|
||||||
key_material=dict(required=False),
|
key_material=dict(required=False),
|
||||||
state = dict(default='present', choices=['present', 'absent']),
|
state = dict(default='present', choices=['present', 'absent']),
|
||||||
wait = dict(type='bool', default=False),
|
wait = dict(type='bool', default=False),
|
||||||
wait_timeout = dict(default=300),
|
wait_timeout = dict(default=300),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
|
|
|
@ -229,7 +229,7 @@ def create_launch_config(connection, module):
|
||||||
result = dict(
|
result = dict(
|
||||||
((a[0], a[1]) for a in vars(launch_configs[0]).items()
|
((a[0], a[1]) for a in vars(launch_configs[0]).items()
|
||||||
if a[0] not in ('connection', 'created_time', 'instance_monitoring', 'block_device_mappings'))
|
if a[0] not in ('connection', 'created_time', 'instance_monitoring', 'block_device_mappings'))
|
||||||
)
|
)
|
||||||
result['created_time'] = str(launch_configs[0].created_time)
|
result['created_time'] = str(launch_configs[0].created_time)
|
||||||
# Looking at boto's launchconfig.py, it looks like this could be a boolean
|
# Looking at boto's launchconfig.py, it looks like this could be a boolean
|
||||||
# value or an object with an enabled attribute. The enabled attribute
|
# value or an object with an enabled attribute. The enabled attribute
|
||||||
|
|
|
@ -261,7 +261,7 @@ def main():
|
||||||
insufficient_data_actions=dict(type='list'),
|
insufficient_data_actions=dict(type='list'),
|
||||||
ok_actions=dict(type='list'),
|
ok_actions=dict(type='list'),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
|
@ -127,9 +127,9 @@ def get_instance_info(instance):
|
||||||
'requester_id': instance.requester_id,
|
'requester_id': instance.requester_id,
|
||||||
'monitoring_state': instance.monitoring_state,
|
'monitoring_state': instance.monitoring_state,
|
||||||
'placement': {
|
'placement': {
|
||||||
'tenancy': instance._placement.tenancy,
|
'tenancy': instance._placement.tenancy,
|
||||||
'zone': instance._placement.zone
|
'zone': instance._placement.zone
|
||||||
},
|
},
|
||||||
'ami_launch_index': instance.ami_launch_index,
|
'ami_launch_index': instance.ami_launch_index,
|
||||||
'launch_time': instance.launch_time,
|
'launch_time': instance.launch_time,
|
||||||
'hypervisor': instance.hypervisor,
|
'hypervisor': instance.hypervisor,
|
||||||
|
|
|
@ -130,10 +130,10 @@ except ImportError:
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
resource = dict(required=True),
|
resource = dict(required=True),
|
||||||
tags = dict(type='dict'),
|
tags = dict(type='dict'),
|
||||||
state = dict(default='present', choices=['present', 'absent', 'list']),
|
state = dict(default='present', choices=['present', 'absent', 'list']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -470,23 +470,23 @@ def get_volume_info(volume, state):
|
||||||
attachment = volume.attach_data
|
attachment = volume.attach_data
|
||||||
|
|
||||||
volume_info = {
|
volume_info = {
|
||||||
'create_time': volume.create_time,
|
'create_time': volume.create_time,
|
||||||
'encrypted': volume.encrypted,
|
'encrypted': volume.encrypted,
|
||||||
'id': volume.id,
|
'id': volume.id,
|
||||||
'iops': volume.iops,
|
'iops': volume.iops,
|
||||||
'size': volume.size,
|
'size': volume.size,
|
||||||
'snapshot_id': volume.snapshot_id,
|
'snapshot_id': volume.snapshot_id,
|
||||||
'status': volume.status,
|
'status': volume.status,
|
||||||
'type': volume.type,
|
'type': volume.type,
|
||||||
'zone': volume.zone,
|
'zone': volume.zone,
|
||||||
'attachment_set': {
|
'attachment_set': {
|
||||||
'attach_time': attachment.attach_time,
|
'attach_time': attachment.attach_time,
|
||||||
'device': attachment.device,
|
'device': attachment.device,
|
||||||
'instance_id': attachment.instance_id,
|
'instance_id': attachment.instance_id,
|
||||||
'status': attachment.status
|
'status': attachment.status
|
||||||
},
|
},
|
||||||
'tags': volume.tags
|
'tags': volume.tags
|
||||||
}
|
}
|
||||||
if hasattr(attachment, 'deleteOnTermination'):
|
if hasattr(attachment, 'deleteOnTermination'):
|
||||||
volume_info['attachment_set']['deleteOnTermination'] = attachment.deleteOnTermination
|
volume_info['attachment_set']['deleteOnTermination'] = attachment.deleteOnTermination
|
||||||
|
|
||||||
|
@ -496,20 +496,20 @@ def get_volume_info(volume, state):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
instance = dict(),
|
instance = dict(),
|
||||||
id = dict(),
|
id = dict(),
|
||||||
name = dict(),
|
name = dict(),
|
||||||
volume_size = dict(),
|
volume_size = dict(),
|
||||||
volume_type = dict(choices=['standard', 'gp2', 'io1', 'st1', 'sc1'], default='standard'),
|
volume_type = dict(choices=['standard', 'gp2', 'io1', 'st1', 'sc1'], default='standard'),
|
||||||
iops = dict(),
|
iops = dict(),
|
||||||
encrypted = dict(type='bool', default=False),
|
encrypted = dict(type='bool', default=False),
|
||||||
kms_key_id = dict(),
|
kms_key_id = dict(),
|
||||||
device_name = dict(),
|
device_name = dict(),
|
||||||
delete_on_termination = dict(type='bool', default=False),
|
delete_on_termination = dict(type='bool', default=False),
|
||||||
zone = dict(aliases=['availability_zone', 'aws_zone', 'ec2_zone']),
|
zone = dict(aliases=['availability_zone', 'aws_zone', 'ec2_zone']),
|
||||||
snapshot = dict(),
|
snapshot = dict(),
|
||||||
state = dict(choices=['absent', 'present', 'list'], default='present')
|
state = dict(choices=['absent', 'present', 'list'], default='present')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -79,24 +79,24 @@ def get_volume_info(volume):
|
||||||
attachment = volume.attach_data
|
attachment = volume.attach_data
|
||||||
|
|
||||||
volume_info = {
|
volume_info = {
|
||||||
'create_time': volume.create_time,
|
'create_time': volume.create_time,
|
||||||
'id': volume.id,
|
'id': volume.id,
|
||||||
'encrypted': volume.encrypted,
|
'encrypted': volume.encrypted,
|
||||||
'iops': volume.iops,
|
'iops': volume.iops,
|
||||||
'size': volume.size,
|
'size': volume.size,
|
||||||
'snapshot_id': volume.snapshot_id,
|
'snapshot_id': volume.snapshot_id,
|
||||||
'status': volume.status,
|
'status': volume.status,
|
||||||
'type': volume.type,
|
'type': volume.type,
|
||||||
'zone': volume.zone,
|
'zone': volume.zone,
|
||||||
'region': volume.region.name,
|
'region': volume.region.name,
|
||||||
'attachment_set': {
|
'attachment_set': {
|
||||||
'attach_time': attachment.attach_time,
|
'attach_time': attachment.attach_time,
|
||||||
'device': attachment.device,
|
'device': attachment.device,
|
||||||
'instance_id': attachment.instance_id,
|
'instance_id': attachment.instance_id,
|
||||||
'status': attachment.status
|
'status': attachment.status
|
||||||
},
|
},
|
||||||
'tags': volume.tags
|
'tags': volume.tags
|
||||||
}
|
}
|
||||||
|
|
||||||
return volume_info
|
return volume_info
|
||||||
|
|
||||||
|
|
|
@ -186,16 +186,16 @@ def get_vpc_values(vpc_obj):
|
||||||
def main():
|
def main():
|
||||||
argument_spec=ec2_argument_spec()
|
argument_spec=ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
name = dict(type='str', default=None, required=True),
|
name = dict(type='str', default=None, required=True),
|
||||||
cidr_block = dict(type='str', default=None, required=True),
|
cidr_block = dict(type='str', default=None, required=True),
|
||||||
tenancy = dict(choices=['default', 'dedicated'], default='default'),
|
tenancy = dict(choices=['default', 'dedicated'], default='default'),
|
||||||
dns_support = dict(type='bool', default=True),
|
dns_support = dict(type='bool', default=True),
|
||||||
dns_hostnames = dict(type='bool', default=True),
|
dns_hostnames = dict(type='bool', default=True),
|
||||||
dhcp_opts_id = dict(type='str', default=None, required=False),
|
dhcp_opts_id = dict(type='str', default=None, required=False),
|
||||||
tags = dict(type='dict', required=False, default=None, aliases=['resource_tags']),
|
tags = dict(type='dict', required=False, default=None, aliases=['resource_tags']),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state = dict(choices=['present', 'absent'], default='present'),
|
||||||
multi_ok = dict(type='bool', default=False)
|
multi_ok = dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -150,7 +150,7 @@ def create_subnet(vpc_conn, vpc_id, cidr, az, check_mode):
|
||||||
subnet = None
|
subnet = None
|
||||||
else:
|
else:
|
||||||
raise AnsibleVPCSubnetCreationException(
|
raise AnsibleVPCSubnetCreationException(
|
||||||
'Unable to create subnet {0}, error: {1}'.format(cidr, e))
|
'Unable to create subnet {0}, error: {1}'.format(cidr, e))
|
||||||
|
|
||||||
return subnet
|
return subnet
|
||||||
|
|
||||||
|
|
|
@ -106,12 +106,12 @@ except ImportError:
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
instance_id = dict(required=True),
|
instance_id = dict(required=True),
|
||||||
key_file = dict(required=True),
|
key_file = dict(required=True),
|
||||||
key_passphrase = dict(no_log=True, default=None, required=False),
|
key_passphrase = dict(no_log=True, default=None, required=False),
|
||||||
wait = dict(type='bool', default=False, required=False),
|
wait = dict(type='bool', default=False, required=False),
|
||||||
wait_timeout = dict(default=120, required=False),
|
wait_timeout = dict(default=120, required=False),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ class EcsServiceManager:
|
||||||
cluster=cluster_name,
|
cluster=cluster_name,
|
||||||
services=[
|
services=[
|
||||||
service_name
|
service_name
|
||||||
])
|
])
|
||||||
msg = ''
|
msg = ''
|
||||||
if len(response['failures'])>0:
|
if len(response['failures'])>0:
|
||||||
c = self.find_in_array(response['failures'], service_name, 'arn')
|
c = self.find_in_array(response['failures'], service_name, 'arn')
|
||||||
|
|
|
@ -483,22 +483,22 @@ class ElastiCacheManager(object):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
state ={'required': True, 'choices': ['present', 'absent', 'rebooted']},
|
state ={'required': True, 'choices': ['present', 'absent', 'rebooted']},
|
||||||
name ={'required': True},
|
name ={'required': True},
|
||||||
engine ={'required': False, 'default': 'memcached'},
|
engine ={'required': False, 'default': 'memcached'},
|
||||||
cache_engine_version ={'required': False},
|
cache_engine_version ={'required': False},
|
||||||
node_type ={'required': False, 'default': 'cache.m1.small'},
|
node_type ={'required': False, 'default': 'cache.m1.small'},
|
||||||
num_nodes ={'required': False, 'default': None, 'type': 'int'},
|
num_nodes ={'required': False, 'default': None, 'type': 'int'},
|
||||||
# alias for compat with the original PR 1950
|
# alias for compat with the original PR 1950
|
||||||
cache_parameter_group ={'required': False, 'default': None, 'aliases': ['parameter_group']},
|
cache_parameter_group ={'required': False, 'default': None, 'aliases': ['parameter_group']},
|
||||||
cache_port ={'required': False, 'type': 'int'},
|
cache_port ={'required': False, 'type': 'int'},
|
||||||
cache_subnet_group ={'required': False, 'default': None},
|
cache_subnet_group ={'required': False, 'default': None},
|
||||||
cache_security_groups ={'required': False, 'default': [], 'type': 'list'},
|
cache_security_groups ={'required': False, 'default': [], 'type': 'list'},
|
||||||
security_group_ids ={'required': False, 'default': [], 'type': 'list'},
|
security_group_ids ={'required': False, 'default': [], 'type': 'list'},
|
||||||
zone ={'required': False, 'default': None},
|
zone ={'required': False, 'default': None},
|
||||||
wait ={'required': False, 'type' : 'bool', 'default': True},
|
wait ={'required': False, 'type' : 'bool', 'default': True},
|
||||||
hard_modify ={'required': False, 'type': 'bool', 'default': False}
|
hard_modify ={'required': False, 'type': 'bool', 'default': False}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -80,11 +80,11 @@ except ImportError:
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
state = dict(required=True, choices=['present', 'absent']),
|
state = dict(required=True, choices=['present', 'absent']),
|
||||||
name = dict(required=True),
|
name = dict(required=True),
|
||||||
description = dict(required=False),
|
description = dict(required=False),
|
||||||
subnets = dict(required=False, type='list'),
|
subnets = dict(required=False, type='list'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -297,9 +297,9 @@ def update_user(module, iam, name, new_name, new_path, key_state, key_count, key
|
||||||
error_msg = boto_exception(err)
|
error_msg = boto_exception(err)
|
||||||
if 'cannot be found' in error_msg and updated:
|
if 'cannot be found' in error_msg and updated:
|
||||||
current_keys, status = \
|
current_keys, status = \
|
||||||
[ck['access_key_id'] for ck in
|
[ck['access_key_id'] for ck in
|
||||||
iam.get_all_access_keys(new_name).list_access_keys_result.access_key_metadata],\
|
iam.get_all_access_keys(new_name).list_access_keys_result.access_key_metadata],\
|
||||||
[ck['status'] for ck in
|
[ck['status'] for ck in
|
||||||
iam.get_all_access_keys(new_name).list_access_keys_result.access_key_metadata]
|
iam.get_all_access_keys(new_name).list_access_keys_result.access_key_metadata]
|
||||||
name = new_name
|
name = new_name
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -129,9 +129,9 @@ def boto_exception(err):
|
||||||
|
|
||||||
def cert_meta(iam, name):
|
def cert_meta(iam, name):
|
||||||
opath = iam.get_server_certificate(name).get_server_certificate_result.\
|
opath = iam.get_server_certificate(name).get_server_certificate_result.\
|
||||||
server_certificate.\
|
server_certificate.\
|
||||||
server_certificate_metadata.\
|
server_certificate_metadata.\
|
||||||
path
|
path
|
||||||
ocert = iam.get_server_certificate(name).get_server_certificate_result.\
|
ocert = iam.get_server_certificate(name).get_server_certificate_result.\
|
||||||
server_certificate.\
|
server_certificate.\
|
||||||
certificate_body
|
certificate_body
|
||||||
|
|
|
@ -694,7 +694,7 @@ def create_db_instance(module, conn):
|
||||||
try:
|
try:
|
||||||
result = conn.create_db_instance(instance_name, module.params.get('size'),
|
result = conn.create_db_instance(instance_name, module.params.get('size'),
|
||||||
module.params.get('instance_type'), module.params.get('db_engine'),
|
module.params.get('instance_type'), module.params.get('db_engine'),
|
||||||
module.params.get('username'), module.params.get('password'), **params)
|
module.params.get('username'), module.params.get('password'), **params)
|
||||||
changed = True
|
changed = True
|
||||||
except RDSException as e:
|
except RDSException as e:
|
||||||
module.fail_json(msg="Failed to create instance: %s" % e.message)
|
module.fail_json(msg="Failed to create instance: %s" % e.message)
|
||||||
|
@ -953,40 +953,40 @@ def validate_parameters(required_vars, valid_vars, module):
|
||||||
|
|
||||||
# map to convert rds module options to boto rds and rds2 options
|
# map to convert rds module options to boto rds and rds2 options
|
||||||
optional_params = {
|
optional_params = {
|
||||||
'port': 'port',
|
'port': 'port',
|
||||||
'db_name': 'db_name',
|
'db_name': 'db_name',
|
||||||
'zone': 'availability_zone',
|
'zone': 'availability_zone',
|
||||||
'maint_window': 'preferred_maintenance_window',
|
'maint_window': 'preferred_maintenance_window',
|
||||||
'backup_window': 'preferred_backup_window',
|
'backup_window': 'preferred_backup_window',
|
||||||
'backup_retention': 'backup_retention_period',
|
'backup_retention': 'backup_retention_period',
|
||||||
'multi_zone': 'multi_az',
|
'multi_zone': 'multi_az',
|
||||||
'engine_version': 'engine_version',
|
'engine_version': 'engine_version',
|
||||||
'upgrade': 'auto_minor_version_upgrade',
|
'upgrade': 'auto_minor_version_upgrade',
|
||||||
'subnet': 'db_subnet_group_name',
|
'subnet': 'db_subnet_group_name',
|
||||||
'license_model': 'license_model',
|
'license_model': 'license_model',
|
||||||
'option_group': 'option_group_name',
|
'option_group': 'option_group_name',
|
||||||
'size': 'allocated_storage',
|
'size': 'allocated_storage',
|
||||||
'iops': 'iops',
|
'iops': 'iops',
|
||||||
'new_instance_name': 'new_instance_id',
|
'new_instance_name': 'new_instance_id',
|
||||||
'apply_immediately': 'apply_immediately',
|
'apply_immediately': 'apply_immediately',
|
||||||
}
|
}
|
||||||
# map to convert rds module options to boto rds options
|
# map to convert rds module options to boto rds options
|
||||||
optional_params_rds = {
|
optional_params_rds = {
|
||||||
'db_engine': 'engine',
|
'db_engine': 'engine',
|
||||||
'password': 'master_password',
|
'password': 'master_password',
|
||||||
'parameter_group': 'param_group',
|
'parameter_group': 'param_group',
|
||||||
'instance_type': 'instance_class',
|
'instance_type': 'instance_class',
|
||||||
}
|
}
|
||||||
# map to convert rds module options to boto rds2 options
|
# map to convert rds module options to boto rds2 options
|
||||||
optional_params_rds2 = {
|
optional_params_rds2 = {
|
||||||
'tags': 'tags',
|
'tags': 'tags',
|
||||||
'publicly_accessible': 'publicly_accessible',
|
'publicly_accessible': 'publicly_accessible',
|
||||||
'parameter_group': 'db_parameter_group_name',
|
'parameter_group': 'db_parameter_group_name',
|
||||||
'character_set_name': 'character_set_name',
|
'character_set_name': 'character_set_name',
|
||||||
'instance_type': 'db_instance_class',
|
'instance_type': 'db_instance_class',
|
||||||
'password': 'master_user_password',
|
'password': 'master_user_password',
|
||||||
'new_instance_name': 'new_db_instance_identifier',
|
'new_instance_name': 'new_db_instance_identifier',
|
||||||
'force_failover': 'force_failover',
|
'force_failover': 'force_failover',
|
||||||
}
|
}
|
||||||
if has_rds2:
|
if has_rds2:
|
||||||
optional_params.update(optional_params_rds2)
|
optional_params.update(optional_params_rds2)
|
||||||
|
@ -1029,40 +1029,40 @@ def validate_parameters(required_vars, valid_vars, module):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
command = dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True),
|
command = dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True),
|
||||||
instance_name = dict(required=False),
|
instance_name = dict(required=False),
|
||||||
source_instance = dict(required=False),
|
source_instance = dict(required=False),
|
||||||
db_engine = dict(choices=['mariadb', 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web', 'postgres', 'aurora'], required=False),
|
db_engine = dict(choices=['mariadb', 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web', 'postgres', 'aurora'], required=False),
|
||||||
size = dict(required=False),
|
size = dict(required=False),
|
||||||
instance_type = dict(aliases=['type'], required=False),
|
instance_type = dict(aliases=['type'], required=False),
|
||||||
username = dict(required=False),
|
username = dict(required=False),
|
||||||
password = dict(no_log=True, required=False),
|
password = dict(no_log=True, required=False),
|
||||||
db_name = dict(required=False),
|
db_name = dict(required=False),
|
||||||
engine_version = dict(required=False),
|
engine_version = dict(required=False),
|
||||||
parameter_group = dict(required=False),
|
parameter_group = dict(required=False),
|
||||||
license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license', 'postgresql-license'], required=False),
|
license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license', 'postgresql-license'], required=False),
|
||||||
multi_zone = dict(type='bool', default=False),
|
multi_zone = dict(type='bool', default=False),
|
||||||
iops = dict(required=False),
|
iops = dict(required=False),
|
||||||
security_groups = dict(required=False),
|
security_groups = dict(required=False),
|
||||||
vpc_security_groups = dict(type='list', required=False),
|
vpc_security_groups = dict(type='list', required=False),
|
||||||
port = dict(required=False),
|
port = dict(required=False),
|
||||||
upgrade = dict(type='bool', default=False),
|
upgrade = dict(type='bool', default=False),
|
||||||
option_group = dict(required=False),
|
option_group = dict(required=False),
|
||||||
maint_window = dict(required=False),
|
maint_window = dict(required=False),
|
||||||
backup_window = dict(required=False),
|
backup_window = dict(required=False),
|
||||||
backup_retention = dict(required=False),
|
backup_retention = dict(required=False),
|
||||||
zone = dict(aliases=['aws_zone', 'ec2_zone'], required=False),
|
zone = dict(aliases=['aws_zone', 'ec2_zone'], required=False),
|
||||||
subnet = dict(required=False),
|
subnet = dict(required=False),
|
||||||
wait = dict(type='bool', default=False),
|
wait = dict(type='bool', default=False),
|
||||||
wait_timeout = dict(type='int', default=300),
|
wait_timeout = dict(type='int', default=300),
|
||||||
snapshot = dict(required=False),
|
snapshot = dict(required=False),
|
||||||
apply_immediately = dict(type='bool', default=False),
|
apply_immediately = dict(type='bool', default=False),
|
||||||
new_instance_name = dict(required=False),
|
new_instance_name = dict(required=False),
|
||||||
tags = dict(type='dict', required=False),
|
tags = dict(type='dict', required=False),
|
||||||
publicly_accessible = dict(required=False),
|
publicly_accessible = dict(required=False),
|
||||||
character_set_name = dict(required=False),
|
character_set_name = dict(required=False),
|
||||||
force_failover = dict(type='bool', required=False, default=False)
|
force_failover = dict(type='bool', required=False, default=False)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
@ -1073,15 +1073,15 @@ def main():
|
||||||
module.fail_json(msg='boto required for this module')
|
module.fail_json(msg='boto required for this module')
|
||||||
|
|
||||||
invocations = {
|
invocations = {
|
||||||
'create': create_db_instance,
|
'create': create_db_instance,
|
||||||
'replicate': replicate_db_instance,
|
'replicate': replicate_db_instance,
|
||||||
'delete': delete_db_instance_or_snapshot,
|
'delete': delete_db_instance_or_snapshot,
|
||||||
'facts': facts_db_instance_or_snapshot,
|
'facts': facts_db_instance_or_snapshot,
|
||||||
'modify': modify_db_instance,
|
'modify': modify_db_instance,
|
||||||
'promote': promote_db_instance,
|
'promote': promote_db_instance,
|
||||||
'snapshot': snapshot_db_instance,
|
'snapshot': snapshot_db_instance,
|
||||||
'reboot': reboot_db_instance,
|
'reboot': reboot_db_instance,
|
||||||
'restore': restore_db_instance,
|
'restore': restore_db_instance,
|
||||||
}
|
}
|
||||||
|
|
||||||
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
|
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
|
||||||
|
|
|
@ -219,13 +219,13 @@ def modify_group(group, params, immediate=False):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
state = dict(required=True, choices=['present', 'absent']),
|
state = dict(required=True, choices=['present', 'absent']),
|
||||||
name = dict(required=True),
|
name = dict(required=True),
|
||||||
engine = dict(required=False, choices=VALID_ENGINES),
|
engine = dict(required=False, choices=VALID_ENGINES),
|
||||||
description = dict(required=False),
|
description = dict(required=False),
|
||||||
params = dict(required=False, aliases=['parameters'], type='dict'),
|
params = dict(required=False, aliases=['parameters'], type='dict'),
|
||||||
immediate = dict(required=False, type='bool'),
|
immediate = dict(required=False, type='bool'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -84,11 +84,11 @@ except ImportError:
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
state = dict(required=True, choices=['present', 'absent']),
|
state = dict(required=True, choices=['present', 'absent']),
|
||||||
name = dict(required=True),
|
name = dict(required=True),
|
||||||
description = dict(required=False),
|
description = dict(required=False),
|
||||||
subnets = dict(required=False, type='list'),
|
subnets = dict(required=False, type='list'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -410,31 +410,31 @@ def modify_cluster(module, redshift):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
command = dict(choices=['create', 'facts', 'delete', 'modify'], required=True),
|
command = dict(choices=['create', 'facts', 'delete', 'modify'], required=True),
|
||||||
identifier = dict(required=True),
|
identifier = dict(required=True),
|
||||||
node_type = dict(choices=['ds1.xlarge', 'ds1.8xlarge', 'ds2.xlarge', 'ds2.8xlarge', 'dc1.large', 'dc1.8xlarge', 'dw1.xlarge', 'dw1.8xlarge', 'dw2.large', 'dw2.8xlarge'], required=False),
|
node_type = dict(choices=['ds1.xlarge', 'ds1.8xlarge', 'ds2.xlarge', 'ds2.8xlarge', 'dc1.large', 'dc1.8xlarge', 'dw1.xlarge', 'dw1.8xlarge', 'dw2.large', 'dw2.8xlarge'], required=False),
|
||||||
username = dict(required=False),
|
username = dict(required=False),
|
||||||
password = dict(no_log=True, required=False),
|
password = dict(no_log=True, required=False),
|
||||||
db_name = dict(require=False),
|
db_name = dict(require=False),
|
||||||
cluster_type = dict(choices=['multi-node', 'single-node', ], default='single-node'),
|
cluster_type = dict(choices=['multi-node', 'single-node', ], default='single-node'),
|
||||||
cluster_security_groups = dict(aliases=['security_groups'], type='list'),
|
cluster_security_groups = dict(aliases=['security_groups'], type='list'),
|
||||||
vpc_security_group_ids = dict(aliases=['vpc_security_groups'], type='list'),
|
vpc_security_group_ids = dict(aliases=['vpc_security_groups'], type='list'),
|
||||||
cluster_subnet_group_name = dict(aliases=['subnet']),
|
cluster_subnet_group_name = dict(aliases=['subnet']),
|
||||||
availability_zone = dict(aliases=['aws_zone', 'zone']),
|
availability_zone = dict(aliases=['aws_zone', 'zone']),
|
||||||
preferred_maintenance_window = dict(aliases=['maintance_window', 'maint_window']),
|
preferred_maintenance_window = dict(aliases=['maintance_window', 'maint_window']),
|
||||||
cluster_parameter_group_name = dict(aliases=['param_group_name']),
|
cluster_parameter_group_name = dict(aliases=['param_group_name']),
|
||||||
automated_snapshot_retention_period = dict(aliases=['retention_period']),
|
automated_snapshot_retention_period = dict(aliases=['retention_period']),
|
||||||
port = dict(type='int'),
|
port = dict(type='int'),
|
||||||
cluster_version = dict(aliases=['version'], choices=['1.0']),
|
cluster_version = dict(aliases=['version'], choices=['1.0']),
|
||||||
allow_version_upgrade = dict(aliases=['version_upgrade'], type='bool', default=True),
|
allow_version_upgrade = dict(aliases=['version_upgrade'], type='bool', default=True),
|
||||||
number_of_nodes = dict(type='int'),
|
number_of_nodes = dict(type='int'),
|
||||||
publicly_accessible = dict(type='bool', default=False),
|
publicly_accessible = dict(type='bool', default=False),
|
||||||
encrypted = dict(type='bool', default=False),
|
encrypted = dict(type='bool', default=False),
|
||||||
elastic_ip = dict(required=False),
|
elastic_ip = dict(required=False),
|
||||||
new_cluster_identifier = dict(aliases=['new_identifier']),
|
new_cluster_identifier = dict(aliases=['new_identifier']),
|
||||||
wait = dict(type='bool', default=False),
|
wait = dict(type='bool', default=False),
|
||||||
wait_timeout = dict(default=300),
|
wait_timeout = dict(default=300),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -388,28 +388,28 @@ def invoke_with_throttling_retries(function_ref, *argv):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
command = dict(choices=['get', 'create', 'delete'], required=True),
|
command = dict(choices=['get', 'create', 'delete'], required=True),
|
||||||
zone = dict(required=True),
|
zone = dict(required=True),
|
||||||
hosted_zone_id = dict(required=False, default=None),
|
hosted_zone_id = dict(required=False, default=None),
|
||||||
record = dict(required=True),
|
record = dict(required=True),
|
||||||
ttl = dict(required=False, type='int', default=3600),
|
ttl = dict(required=False, type='int', default=3600),
|
||||||
type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS', 'SOA'], required=True),
|
type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS', 'SOA'], required=True),
|
||||||
alias = dict(required=False, type='bool'),
|
alias = dict(required=False, type='bool'),
|
||||||
alias_hosted_zone_id = dict(required=False),
|
alias_hosted_zone_id = dict(required=False),
|
||||||
alias_evaluate_target_health = dict(required=False, type='bool', default=False),
|
alias_evaluate_target_health = dict(required=False, type='bool', default=False),
|
||||||
value = dict(required=False),
|
value = dict(required=False),
|
||||||
overwrite = dict(required=False, type='bool'),
|
overwrite = dict(required=False, type='bool'),
|
||||||
retry_interval = dict(required=False, default=500),
|
retry_interval = dict(required=False, default=500),
|
||||||
private_zone = dict(required=False, type='bool', default=False),
|
private_zone = dict(required=False, type='bool', default=False),
|
||||||
identifier = dict(required=False, default=None),
|
identifier = dict(required=False, default=None),
|
||||||
weight = dict(required=False, type='int'),
|
weight = dict(required=False, type='int'),
|
||||||
region = dict(required=False),
|
region = dict(required=False),
|
||||||
health_check = dict(required=False),
|
health_check = dict(required=False),
|
||||||
failover = dict(required=False,choices=['PRIMARY','SECONDARY']),
|
failover = dict(required=False,choices=['PRIMARY','SECONDARY']),
|
||||||
vpc_id = dict(required=False),
|
vpc_id = dict(required=False),
|
||||||
wait = dict(required=False, type='bool', default=False),
|
wait = dict(required=False, type='bool', default=False),
|
||||||
wait_timeout = dict(required=False, type='int', default=300),
|
wait_timeout = dict(required=False, type='int', default=300),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -275,16 +275,16 @@ def update_health_check(conn, health_check_id, health_check_version, health_chec
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state = dict(choices=['present', 'absent'], default='present'),
|
||||||
ip_address = dict(),
|
ip_address = dict(),
|
||||||
port = dict(type='int'),
|
port = dict(type='int'),
|
||||||
type = dict(required=True, choices=['HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP']),
|
type = dict(required=True, choices=['HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP']),
|
||||||
resource_path = dict(),
|
resource_path = dict(),
|
||||||
fqdn = dict(),
|
fqdn = dict(),
|
||||||
string_match = dict(),
|
string_match = dict(),
|
||||||
request_interval = dict(type='int', choices=[10, 30], default=30),
|
request_interval = dict(type='int', choices=[10, 30], default=30),
|
||||||
failure_threshold = dict(type='int', choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], default=3),
|
failure_threshold = dict(type='int', choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], default=3),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -138,11 +138,11 @@ from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
zone=dict(required=True),
|
zone=dict(required=True),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
vpc_id=dict(default=None),
|
vpc_id=dict(default=None),
|
||||||
vpc_region=dict(default=None),
|
vpc_region=dict(default=None),
|
||||||
comment=dict(default='')))
|
comment=dict(default='')))
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
if not HAS_BOTO:
|
if not HAS_BOTO:
|
||||||
|
|
|
@ -433,25 +433,25 @@ def is_walrus(s3_url):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
bucket = dict(required=True),
|
bucket = dict(required=True),
|
||||||
dest = dict(default=None),
|
dest = dict(default=None),
|
||||||
encrypt = dict(default=True, type='bool'),
|
encrypt = dict(default=True, type='bool'),
|
||||||
expiry = dict(default=600, aliases=['expiration']),
|
expiry = dict(default=600, aliases=['expiration']),
|
||||||
headers = dict(type='dict'),
|
headers = dict(type='dict'),
|
||||||
marker = dict(default=None),
|
marker = dict(default=None),
|
||||||
max_keys = dict(default=1000),
|
max_keys = dict(default=1000),
|
||||||
metadata = dict(type='dict'),
|
metadata = dict(type='dict'),
|
||||||
mode = dict(choices=['get', 'put', 'delete', 'create', 'geturl', 'getstr', 'delobj', 'list'], required=True),
|
mode = dict(choices=['get', 'put', 'delete', 'create', 'geturl', 'getstr', 'delobj', 'list'], required=True),
|
||||||
object = dict(),
|
object = dict(),
|
||||||
permission = dict(type='list', default=['private']),
|
permission = dict(type='list', default=['private']),
|
||||||
version = dict(default=None),
|
version = dict(default=None),
|
||||||
overwrite = dict(aliases=['force'], default='always'),
|
overwrite = dict(aliases=['force'], default='always'),
|
||||||
prefix = dict(default=None),
|
prefix = dict(default=None),
|
||||||
retries = dict(aliases=['retry'], type='int', default=0),
|
retries = dict(aliases=['retry'], type='int', default=0),
|
||||||
s3_url = dict(aliases=['S3_URL']),
|
s3_url = dict(aliases=['S3_URL']),
|
||||||
rgw = dict(default='no', type='bool'),
|
rgw = dict(default='no', type='bool'),
|
||||||
src = dict(),
|
src = dict(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -377,11 +377,11 @@ def main():
|
||||||
|
|
||||||
module = AnsibleModule(argument_spec=argument_spec,
|
module = AnsibleModule(argument_spec=argument_spec,
|
||||||
mutually_exclusive = [
|
mutually_exclusive = [
|
||||||
[ 'expiration_days', 'expiration_date' ],
|
[ 'expiration_days', 'expiration_date' ],
|
||||||
[ 'expiration_days', 'transition_date' ],
|
[ 'expiration_days', 'transition_date' ],
|
||||||
[ 'transition_days', 'transition_date' ],
|
[ 'transition_days', 'transition_date' ],
|
||||||
[ 'transition_days', 'expiration_date' ]
|
[ 'transition_days', 'expiration_date' ]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_BOTO:
|
if not HAS_BOTO:
|
||||||
|
|
|
@ -306,7 +306,7 @@ def gather_files(fileroot, include=None, exclude=None):
|
||||||
'chopped_path':chopped_path,
|
'chopped_path':chopped_path,
|
||||||
'modified_epoch': f_modified_epoch,
|
'modified_epoch': f_modified_epoch,
|
||||||
'bytes': f_size
|
'bytes': f_size
|
||||||
})
|
})
|
||||||
# dirpath = path *to* the directory
|
# dirpath = path *to* the directory
|
||||||
# dirnames = subdirs *in* our directory
|
# dirnames = subdirs *in* our directory
|
||||||
# filenames
|
# filenames
|
||||||
|
@ -428,7 +428,7 @@ def upload_files(s3, bucket, filelist, params):
|
||||||
ret = []
|
ret = []
|
||||||
for entry in filelist:
|
for entry in filelist:
|
||||||
args = {
|
args = {
|
||||||
'ContentType': entry['mime_type']
|
'ContentType': entry['mime_type']
|
||||||
}
|
}
|
||||||
if params.get('permission'):
|
if params.get('permission'):
|
||||||
args['ACL'] = params['permission']
|
args['ACL'] = params['permission']
|
||||||
|
@ -440,18 +440,18 @@ def upload_files(s3, bucket, filelist, params):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
mode = dict(choices=['push'], default='push'),
|
mode = dict(choices=['push'], default='push'),
|
||||||
file_change_strategy = dict(choices=['force','date_size','checksum'], default='date_size'),
|
file_change_strategy = dict(choices=['force','date_size','checksum'], default='date_size'),
|
||||||
bucket = dict(required=True),
|
bucket = dict(required=True),
|
||||||
key_prefix = dict(required=False, default=''),
|
key_prefix = dict(required=False, default=''),
|
||||||
file_root = dict(required=True, type='path'),
|
file_root = dict(required=True, type='path'),
|
||||||
permission = dict(required=False, choices=['private', 'public-read', 'public-read-write', 'authenticated-read', 'aws-exec-read', 'bucket-owner-read', 'bucket-owner-full-control']),
|
permission = dict(required=False, choices=['private', 'public-read', 'public-read-write', 'authenticated-read', 'aws-exec-read', 'bucket-owner-read', 'bucket-owner-full-control']),
|
||||||
retries = dict(required=False),
|
retries = dict(required=False),
|
||||||
mime_map = dict(required=False, type='dict'),
|
mime_map = dict(required=False, type='dict'),
|
||||||
exclude = dict(required=False, default=".*"),
|
exclude = dict(required=False, default=".*"),
|
||||||
include = dict(required=False, default="*"),
|
include = dict(required=False, default="*"),
|
||||||
# future options: cache_control (string or map, perhaps), encoding, metadata, storage_class, retries
|
# future options: cache_control (string or map, perhaps), encoding, metadata, storage_class, retries
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -267,9 +267,9 @@ def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
mutually_exclusive = [
|
mutually_exclusive = [
|
||||||
['redirect_all_requests', 'suffix'],
|
['redirect_all_requests', 'suffix'],
|
||||||
['redirect_all_requests', 'error_key']
|
['redirect_all_requests', 'error_key']
|
||||||
])
|
])
|
||||||
|
|
||||||
if not HAS_BOTO3:
|
if not HAS_BOTO3:
|
||||||
module.fail_json(msg='boto3 required for this module')
|
module.fail_json(msg='boto3 required for this module')
|
||||||
|
|
|
@ -89,10 +89,10 @@ def core(module):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
revision = dict(default='latest', required=False, aliases=["version"]),
|
revision = dict(default='latest', required=False, aliases=["version"]),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verify that the platform is atomic host
|
# Verify that the platform is atomic host
|
||||||
if not os.path.exists("/run/ostree-booted"):
|
if not os.path.exists("/run/ostree-booted"):
|
||||||
|
|
|
@ -119,12 +119,12 @@ def core(module):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
name = dict(default=None, required=True),
|
name = dict(default=None, required=True),
|
||||||
state = dict(default='latest', choices=['present', 'absent', 'latest']),
|
state = dict(default='latest', choices=['present', 'absent', 'latest']),
|
||||||
started = dict(default='yes', type='bool'),
|
started = dict(default='yes', type='bool'),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verify that the platform supports atomic command
|
# Verify that the platform supports atomic command
|
||||||
rc, out, err = module.run_command('atomic -v', check_rc=False)
|
rc, out, err = module.run_command('atomic -v', check_rc=False)
|
||||||
|
|
|
@ -299,9 +299,9 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack):
|
||||||
|
|
||||||
def _icmp_match(self, rule, protocol, icmp_code, icmp_type):
|
def _icmp_match(self, rule, protocol, icmp_code, icmp_type):
|
||||||
return protocol == 'icmp' \
|
return protocol == 'icmp' \
|
||||||
and protocol == rule['protocol'] \
|
and protocol == rule['protocol'] \
|
||||||
and icmp_code == rule['icmpcode'] \
|
and icmp_code == rule['icmpcode'] \
|
||||||
and icmp_type == rule['icmptype']
|
and icmp_type == rule['icmptype']
|
||||||
|
|
||||||
|
|
||||||
def _type_cidr_match(self, rule, cidr):
|
def _type_cidr_match(self, rule, cidr):
|
||||||
|
|
|
@ -206,27 +206,27 @@ class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack):
|
||||||
|
|
||||||
def _tcp_udp_match(self, rule, protocol, start_port, end_port):
|
def _tcp_udp_match(self, rule, protocol, start_port, end_port):
|
||||||
return protocol in ['tcp', 'udp'] \
|
return protocol in ['tcp', 'udp'] \
|
||||||
and protocol == rule['protocol'] \
|
and protocol == rule['protocol'] \
|
||||||
and start_port == int(rule['startport']) \
|
and start_port == int(rule['startport']) \
|
||||||
and end_port == int(rule['endport'])
|
and end_port == int(rule['endport'])
|
||||||
|
|
||||||
|
|
||||||
def _icmp_match(self, rule, protocol, icmp_code, icmp_type):
|
def _icmp_match(self, rule, protocol, icmp_code, icmp_type):
|
||||||
return protocol == 'icmp' \
|
return protocol == 'icmp' \
|
||||||
and protocol == rule['protocol'] \
|
and protocol == rule['protocol'] \
|
||||||
and icmp_code == int(rule['icmpcode']) \
|
and icmp_code == int(rule['icmpcode']) \
|
||||||
and icmp_type == int(rule['icmptype'])
|
and icmp_type == int(rule['icmptype'])
|
||||||
|
|
||||||
|
|
||||||
def _ah_esp_gre_match(self, rule, protocol):
|
def _ah_esp_gre_match(self, rule, protocol):
|
||||||
return protocol in ['ah', 'esp', 'gre'] \
|
return protocol in ['ah', 'esp', 'gre'] \
|
||||||
and protocol == rule['protocol']
|
and protocol == rule['protocol']
|
||||||
|
|
||||||
|
|
||||||
def _type_security_group_match(self, rule, security_group_name):
|
def _type_security_group_match(self, rule, security_group_name):
|
||||||
return security_group_name \
|
return security_group_name \
|
||||||
and 'securitygroupname' in rule \
|
and 'securitygroupname' in rule \
|
||||||
and security_group_name == rule['securitygroupname']
|
and security_group_name == rule['securitygroupname']
|
||||||
|
|
||||||
|
|
||||||
def _type_cidr_match(self, rule, cidr):
|
def _type_cidr_match(self, rule, cidr):
|
||||||
|
|
|
@ -682,26 +682,26 @@ class DockerManager(object):
|
||||||
# docker-py version is a tuple of ints because we have to compare them
|
# docker-py version is a tuple of ints because we have to compare them
|
||||||
# server APIVersion is passed to a docker-py function that takes strings
|
# server APIVersion is passed to a docker-py function that takes strings
|
||||||
_cap_ver_req = {
|
_cap_ver_req = {
|
||||||
'devices': ((0, 7, 0), '1.2'),
|
'devices': ((0, 7, 0), '1.2'),
|
||||||
'dns': ((0, 3, 0), '1.10'),
|
'dns': ((0, 3, 0), '1.10'),
|
||||||
'volumes_from': ((0, 3, 0), '1.10'),
|
'volumes_from': ((0, 3, 0), '1.10'),
|
||||||
'restart_policy': ((0, 5, 0), '1.14'),
|
'restart_policy': ((0, 5, 0), '1.14'),
|
||||||
'extra_hosts': ((0, 7, 0), '1.3.1'),
|
'extra_hosts': ((0, 7, 0), '1.3.1'),
|
||||||
'pid': ((1, 0, 0), '1.17'),
|
'pid': ((1, 0, 0), '1.17'),
|
||||||
'log_driver': ((1, 2, 0), '1.18'),
|
'log_driver': ((1, 2, 0), '1.18'),
|
||||||
'log_opt': ((1, 2, 0), '1.18'),
|
'log_opt': ((1, 2, 0), '1.18'),
|
||||||
'host_config': ((0, 7, 0), '1.15'),
|
'host_config': ((0, 7, 0), '1.15'),
|
||||||
'cpu_set': ((0, 6, 0), '1.14'),
|
'cpu_set': ((0, 6, 0), '1.14'),
|
||||||
'cap_add': ((0, 5, 0), '1.14'),
|
'cap_add': ((0, 5, 0), '1.14'),
|
||||||
'cap_drop': ((0, 5, 0), '1.14'),
|
'cap_drop': ((0, 5, 0), '1.14'),
|
||||||
'read_only': ((1, 0, 0), '1.17'),
|
'read_only': ((1, 0, 0), '1.17'),
|
||||||
'labels': ((1, 2, 0), '1.18'),
|
'labels': ((1, 2, 0), '1.18'),
|
||||||
'stop_timeout': ((0, 5, 0), '1.0'),
|
'stop_timeout': ((0, 5, 0), '1.0'),
|
||||||
'ulimits': ((1, 2, 0), '1.18'),
|
'ulimits': ((1, 2, 0), '1.18'),
|
||||||
# Clientside only
|
# Clientside only
|
||||||
'insecure_registry': ((0, 5, 0), '0.0'),
|
'insecure_registry': ((0, 5, 0), '0.0'),
|
||||||
'env_file': ((1, 4, 0), '0.0')
|
'env_file': ((1, 4, 0), '0.0')
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, module):
|
def __init__(self, module):
|
||||||
self.module = module
|
self.module = module
|
||||||
|
|
|
@ -1475,10 +1475,10 @@ class Container(DockerBaseClass):
|
||||||
else:
|
else:
|
||||||
expected_devices.append(
|
expected_devices.append(
|
||||||
dict(
|
dict(
|
||||||
CgroupPermissions=parts[2],
|
CgroupPermissions=parts[2],
|
||||||
PathInContainer=parts[1],
|
PathInContainer=parts[1],
|
||||||
PathOnHost=parts[0]
|
PathOnHost=parts[0]
|
||||||
))
|
))
|
||||||
return expected_devices
|
return expected_devices
|
||||||
|
|
||||||
def _get_expected_entrypoint(self):
|
def _get_expected_entrypoint(self):
|
||||||
|
|
|
@ -225,7 +225,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
gcelb = get_driver_lb(Provider_lb.GCE)(gce_driver=gce)
|
gcelb = get_driver_lb(Provider_lb.GCE)(gce_driver=gce)
|
||||||
gcelb.connection.user_agent_append("%s/%s" % (
|
gcelb.connection.user_agent_append("%s/%s" % (
|
||||||
USER_AGENT_PRODUCT, USER_AGENT_VERSION))
|
USER_AGENT_PRODUCT, USER_AGENT_VERSION))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=unexpected_error_msg(e), changed=False)
|
module.fail_json(msg=unexpected_error_msg(e), changed=False)
|
||||||
|
|
||||||
|
|
|
@ -829,7 +829,7 @@ def main():
|
||||||
if not autoscaler:
|
if not autoscaler:
|
||||||
module.fail_json(msg='Unable to fetch autoscaler %s to delete \
|
module.fail_json(msg='Unable to fetch autoscaler %s to delete \
|
||||||
in zone: %s' % (params['autoscaling']['name'], params['zone']),
|
in zone: %s' % (params['autoscaling']['name'], params['zone']),
|
||||||
changed=False)
|
changed=False)
|
||||||
|
|
||||||
changed = delete_autoscaler(autoscaler)
|
changed = delete_autoscaler(autoscaler)
|
||||||
json_output['deleted_autoscaler'] = changed
|
json_output['deleted_autoscaler'] = changed
|
||||||
|
|
|
@ -254,7 +254,7 @@ def main():
|
||||||
|
|
||||||
if instance_name and inst is None:
|
if instance_name and inst is None:
|
||||||
module.fail_json(msg='Instance %s does not exist in zone %s' % (
|
module.fail_json(msg='Instance %s does not exist in zone %s' % (
|
||||||
instance_name, zone), changed=False)
|
instance_name, zone), changed=False)
|
||||||
|
|
||||||
if not disk:
|
if not disk:
|
||||||
if image is not None and snapshot is not None:
|
if image is not None and snapshot is not None:
|
||||||
|
|
|
@ -182,10 +182,10 @@ def main():
|
||||||
project_id=dict(),
|
project_id=dict(),
|
||||||
),
|
),
|
||||||
mutually_exclusive=[
|
mutually_exclusive=[
|
||||||
[ 'instance_name', 'instance_pattern' ]
|
[ 'instance_name', 'instance_pattern' ]
|
||||||
],
|
],
|
||||||
required_one_of=[
|
required_one_of=[
|
||||||
[ 'instance_name', 'instance_pattern' ]
|
[ 'instance_name', 'instance_pattern' ]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -226,17 +226,17 @@ def pull_messages(pull_params, sub):
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module = AnsibleModule(argument_spec=dict(
|
module = AnsibleModule(argument_spec=dict(
|
||||||
topic=dict(required=True),
|
topic=dict(required=True),
|
||||||
state=dict(choices=['absent', 'present'], default='present'),
|
state=dict(choices=['absent', 'present'], default='present'),
|
||||||
publish=dict(type='list', default=None),
|
publish=dict(type='list', default=None),
|
||||||
subscription=dict(type='dict', default=None),
|
subscription=dict(type='dict', default=None),
|
||||||
service_account_email=dict(),
|
service_account_email=dict(),
|
||||||
credentials_file=dict(),
|
credentials_file=dict(),
|
||||||
project_id=dict(), ),)
|
project_id=dict(), ),)
|
||||||
|
|
||||||
if not HAS_PYTHON26:
|
if not HAS_PYTHON26:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="GCE module requires python's 'ast' module, python v2.6+")
|
msg="GCE module requires python's 'ast' module, python v2.6+")
|
||||||
|
|
||||||
if not HAS_GOOGLE_CLOUD_PUBSUB:
|
if not HAS_GOOGLE_CLOUD_PUBSUB:
|
||||||
module.fail_json(msg="Please install google-cloud-pubsub library.")
|
module.fail_json(msg="Please install google-cloud-pubsub library.")
|
||||||
|
@ -307,7 +307,7 @@ def main():
|
||||||
if s.push_endpoint is not None:
|
if s.push_endpoint is not None:
|
||||||
module.fail_json(msg="Cannot pull messages, push_endpoint is configured.")
|
module.fail_json(msg="Cannot pull messages, push_endpoint is configured.")
|
||||||
(json_output['pulled_messages'], changed) = pull_messages(
|
(json_output['pulled_messages'], changed) = pull_messages(
|
||||||
mod_params['subscription']['pull'], s)
|
mod_params['subscription']['pull'], s)
|
||||||
|
|
||||||
# publish messages to the topic
|
# publish messages to the topic
|
||||||
if mod_params['publish'] and len(mod_params['publish']) > 0:
|
if mod_params['publish'] and len(mod_params['publish']) > 0:
|
||||||
|
|
|
@ -102,16 +102,16 @@ def list_func(data, member='name'):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(argument_spec=dict(
|
module = AnsibleModule(argument_spec=dict(
|
||||||
view=dict(choices=['topics', 'subscriptions'], default='topics'),
|
view=dict(choices=['topics', 'subscriptions'], default='topics'),
|
||||||
topic=dict(required=False),
|
topic=dict(required=False),
|
||||||
state=dict(choices=['list'], default='list'),
|
state=dict(choices=['list'], default='list'),
|
||||||
service_account_email=dict(),
|
service_account_email=dict(),
|
||||||
credentials_file=dict(),
|
credentials_file=dict(),
|
||||||
project_id=dict(), ),)
|
project_id=dict(), ),)
|
||||||
|
|
||||||
if not HAS_PYTHON26:
|
if not HAS_PYTHON26:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="GCE module requires python's 'ast' module, python v2.6+")
|
msg="GCE module requires python's 'ast' module, python v2.6+")
|
||||||
|
|
||||||
if not HAS_GOOGLE_CLOUD_PUBSUB:
|
if not HAS_GOOGLE_CLOUD_PUBSUB:
|
||||||
module.fail_json(msg="Please install google-cloud-pubsub library.")
|
module.fail_json(msg="Please install google-cloud-pubsub library.")
|
||||||
|
|
|
@ -282,13 +282,13 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||||
size = servers[0]['TOTALHD'] - swap
|
size = servers[0]['TOTALHD'] - swap
|
||||||
if ssh_pub_key:
|
if ssh_pub_key:
|
||||||
res = api.linode_disk_createfromdistribution(
|
res = api.linode_disk_createfromdistribution(
|
||||||
LinodeId=linode_id, DistributionID=distribution,
|
LinodeId=linode_id, DistributionID=distribution,
|
||||||
rootPass=password, rootSSHKey=ssh_pub_key,
|
rootPass=password, rootSSHKey=ssh_pub_key,
|
||||||
Label='%s data disk (lid: %s)' % (name, linode_id), Size=size)
|
Label='%s data disk (lid: %s)' % (name, linode_id), Size=size)
|
||||||
else:
|
else:
|
||||||
res = api.linode_disk_createfromdistribution(
|
res = api.linode_disk_createfromdistribution(
|
||||||
LinodeId=linode_id, DistributionID=distribution, rootPass=password,
|
LinodeId=linode_id, DistributionID=distribution, rootPass=password,
|
||||||
Label='%s data disk (lid: %s)' % (name, linode_id), Size=size)
|
Label='%s data disk (lid: %s)' % (name, linode_id), Size=size)
|
||||||
jobs.append(res['JobID'])
|
jobs.append(res['JobID'])
|
||||||
# Create SWAP disk
|
# Create SWAP disk
|
||||||
res = api.linode_disk_create(LinodeId=linode_id, Type='swap',
|
res = api.linode_disk_create(LinodeId=linode_id, Type='swap',
|
||||||
|
|
|
@ -402,33 +402,33 @@ def umount_instance(module, proxmox, vm, vmid, timeout):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
api_host = dict(required=True),
|
api_host = dict(required=True),
|
||||||
api_user = dict(required=True),
|
api_user = dict(required=True),
|
||||||
api_password = dict(no_log=True),
|
api_password = dict(no_log=True),
|
||||||
vmid = dict(required=False),
|
vmid = dict(required=False),
|
||||||
validate_certs = dict(type='bool', default='no'),
|
validate_certs = dict(type='bool', default='no'),
|
||||||
node = dict(),
|
node = dict(),
|
||||||
pool = dict(),
|
pool = dict(),
|
||||||
password = dict(no_log=True),
|
password = dict(no_log=True),
|
||||||
hostname = dict(),
|
hostname = dict(),
|
||||||
ostemplate = dict(),
|
ostemplate = dict(),
|
||||||
disk = dict(type='str', default='3'),
|
disk = dict(type='str', default='3'),
|
||||||
cpus = dict(type='int', default=1),
|
cpus = dict(type='int', default=1),
|
||||||
memory = dict(type='int', default=512),
|
memory = dict(type='int', default=512),
|
||||||
swap = dict(type='int', default=0),
|
swap = dict(type='int', default=0),
|
||||||
netif = dict(type='dict'),
|
netif = dict(type='dict'),
|
||||||
mounts = dict(type='dict'),
|
mounts = dict(type='dict'),
|
||||||
ip_address = dict(),
|
ip_address = dict(),
|
||||||
onboot = dict(type='bool', default='no'),
|
onboot = dict(type='bool', default='no'),
|
||||||
storage = dict(default='local'),
|
storage = dict(default='local'),
|
||||||
cpuunits = dict(type='int', default=1000),
|
cpuunits = dict(type='int', default=1000),
|
||||||
nameserver = dict(),
|
nameserver = dict(),
|
||||||
searchdomain = dict(),
|
searchdomain = dict(),
|
||||||
timeout = dict(type='int', default=30),
|
timeout = dict(type='int', default=30),
|
||||||
force = dict(type='bool', default='no'),
|
force = dict(type='bool', default='no'),
|
||||||
state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']),
|
state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_PROXMOXER:
|
if not HAS_PROXMOXER:
|
||||||
|
|
|
@ -795,71 +795,71 @@ def stop_vm(module, proxmox, vm, vmid, timeout, force):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
acpi = dict(type='bool', default='yes'),
|
acpi = dict(type='bool', default='yes'),
|
||||||
agent = dict(type='bool'),
|
agent = dict(type='bool'),
|
||||||
args = dict(type='str', default=None),
|
args = dict(type='str', default=None),
|
||||||
api_host = dict(required=True),
|
api_host = dict(required=True),
|
||||||
api_user = dict(required=True),
|
api_user = dict(required=True),
|
||||||
api_password = dict(no_log=True),
|
api_password = dict(no_log=True),
|
||||||
autostart = dict(type='bool', default='no'),
|
autostart = dict(type='bool', default='no'),
|
||||||
balloon = dict(type='int',default=0),
|
balloon = dict(type='int',default=0),
|
||||||
bios = dict(choices=['seabios', 'ovmf']),
|
bios = dict(choices=['seabios', 'ovmf']),
|
||||||
boot = dict(type='str', default='cnd'),
|
boot = dict(type='str', default='cnd'),
|
||||||
bootdisk = dict(type='str'),
|
bootdisk = dict(type='str'),
|
||||||
cores = dict(type='int', default=1),
|
cores = dict(type='int', default=1),
|
||||||
cpu = dict(type='str', default='kvm64'),
|
cpu = dict(type='str', default='kvm64'),
|
||||||
cpulimit = dict(type='int'),
|
cpulimit = dict(type='int'),
|
||||||
cpuunits = dict(type='int', default=1000),
|
cpuunits = dict(type='int', default=1000),
|
||||||
delete = dict(type='str'),
|
delete = dict(type='str'),
|
||||||
description = dict(type='str'),
|
description = dict(type='str'),
|
||||||
digest = dict(type='str'),
|
digest = dict(type='str'),
|
||||||
force = dict(type='bool', default=None),
|
force = dict(type='bool', default=None),
|
||||||
freeze = dict(type='bool'),
|
freeze = dict(type='bool'),
|
||||||
hostpci = dict(type='dict'),
|
hostpci = dict(type='dict'),
|
||||||
hotplug = dict(type='str'),
|
hotplug = dict(type='str'),
|
||||||
hugepages = dict(choices=['any', '2', '1024']),
|
hugepages = dict(choices=['any', '2', '1024']),
|
||||||
ide = dict(type='dict', default=None),
|
ide = dict(type='dict', default=None),
|
||||||
keyboard = dict(type='str'),
|
keyboard = dict(type='str'),
|
||||||
kvm = dict(type='bool', default='yes'),
|
kvm = dict(type='bool', default='yes'),
|
||||||
localtime = dict(type='bool'),
|
localtime = dict(type='bool'),
|
||||||
lock = dict(choices=['migrate', 'backup', 'snapshot', 'rollback']),
|
lock = dict(choices=['migrate', 'backup', 'snapshot', 'rollback']),
|
||||||
machine = dict(type='str'),
|
machine = dict(type='str'),
|
||||||
memory = dict(type='int', default=512),
|
memory = dict(type='int', default=512),
|
||||||
migrate_downtime = dict(type='int'),
|
migrate_downtime = dict(type='int'),
|
||||||
migrate_speed = dict(type='int'),
|
migrate_speed = dict(type='int'),
|
||||||
name = dict(type='str'),
|
name = dict(type='str'),
|
||||||
net = dict(type='dict'),
|
net = dict(type='dict'),
|
||||||
node = dict(),
|
node = dict(),
|
||||||
numa = dict(type='dict'),
|
numa = dict(type='dict'),
|
||||||
onboot = dict(type='bool', default='yes'),
|
onboot = dict(type='bool', default='yes'),
|
||||||
ostype = dict(default='l26', choices=['other', 'wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'l24', 'l26', 'solaris']),
|
ostype = dict(default='l26', choices=['other', 'wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'l24', 'l26', 'solaris']),
|
||||||
parallel = dict(type='dict'),
|
parallel = dict(type='dict'),
|
||||||
protection = dict(type='bool'),
|
protection = dict(type='bool'),
|
||||||
reboot = dict(type='bool'),
|
reboot = dict(type='bool'),
|
||||||
revert = dict(),
|
revert = dict(),
|
||||||
sata = dict(type='dict'),
|
sata = dict(type='dict'),
|
||||||
scsi = dict(type='dict'),
|
scsi = dict(type='dict'),
|
||||||
scsihw = dict(choices=['lsi', 'lsi53c810', 'virtio-scsi-pci', 'virtio-scsi-single', 'megasas', 'pvscsi']),
|
scsihw = dict(choices=['lsi', 'lsi53c810', 'virtio-scsi-pci', 'virtio-scsi-single', 'megasas', 'pvscsi']),
|
||||||
serial = dict(type='dict'),
|
serial = dict(type='dict'),
|
||||||
shares = dict(type='int'),
|
shares = dict(type='int'),
|
||||||
skiplock = dict(type='bool'),
|
skiplock = dict(type='bool'),
|
||||||
smbios = dict(type='str'),
|
smbios = dict(type='str'),
|
||||||
sockets = dict(type='int', default=1),
|
sockets = dict(type='int', default=1),
|
||||||
startdate = dict(type='str'),
|
startdate = dict(type='str'),
|
||||||
startup = dict(),
|
startup = dict(),
|
||||||
state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted', 'current']),
|
state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted', 'current']),
|
||||||
tablet = dict(type='bool', default='no'),
|
tablet = dict(type='bool', default='no'),
|
||||||
tdf = dict(type='bool'),
|
tdf = dict(type='bool'),
|
||||||
template = dict(type='bool', default='no'),
|
template = dict(type='bool', default='no'),
|
||||||
timeout = dict(type='int', default=30),
|
timeout = dict(type='int', default=30),
|
||||||
validate_certs = dict(type='bool', default='no'),
|
validate_certs = dict(type='bool', default='no'),
|
||||||
vcpus = dict(type='int', default=None),
|
vcpus = dict(type='int', default=None),
|
||||||
vga = dict(default='std', choices=['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']),
|
vga = dict(default='std', choices=['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']),
|
||||||
virtio = dict(type='dict', default=None),
|
virtio = dict(type='dict', default=None),
|
||||||
vmid = dict(type='int', default=None),
|
vmid = dict(type='int', default=None),
|
||||||
watchdog = dict(),
|
watchdog = dict(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_PROXMOXER:
|
if not HAS_PROXMOXER:
|
||||||
|
|
|
@ -179,20 +179,20 @@ def delete_template(module, proxmox, node, storage, content_type, template, time
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
api_host = dict(required=True),
|
api_host = dict(required=True),
|
||||||
api_user = dict(required=True),
|
api_user = dict(required=True),
|
||||||
api_password = dict(no_log=True),
|
api_password = dict(no_log=True),
|
||||||
validate_certs = dict(type='bool', default='no'),
|
validate_certs = dict(type='bool', default='no'),
|
||||||
node = dict(),
|
node = dict(),
|
||||||
src = dict(),
|
src = dict(),
|
||||||
template = dict(),
|
template = dict(),
|
||||||
content_type = dict(default='vztmpl', choices=['vztmpl','iso']),
|
content_type = dict(default='vztmpl', choices=['vztmpl','iso']),
|
||||||
storage = dict(default='local'),
|
storage = dict(default='local'),
|
||||||
timeout = dict(type='int', default=30),
|
timeout = dict(type='int', default=30),
|
||||||
force = dict(type='bool', default='no'),
|
force = dict(type='bool', default='no'),
|
||||||
state = dict(default='present', choices=['present', 'absent']),
|
state = dict(default='present', choices=['present', 'absent']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_PROXMOXER:
|
if not HAS_PROXMOXER:
|
||||||
|
|
|
@ -132,13 +132,13 @@ ALL_COMMANDS.extend(VM_COMMANDS)
|
||||||
ALL_COMMANDS.extend(HOST_COMMANDS)
|
ALL_COMMANDS.extend(HOST_COMMANDS)
|
||||||
|
|
||||||
VIRT_STATE_NAME_MAP = {
|
VIRT_STATE_NAME_MAP = {
|
||||||
0 : "running",
|
0 : "running",
|
||||||
1 : "running",
|
1 : "running",
|
||||||
2 : "running",
|
2 : "running",
|
||||||
3 : "paused",
|
3 : "paused",
|
||||||
4 : "shutdown",
|
4 : "shutdown",
|
||||||
5 : "shutdown",
|
5 : "shutdown",
|
||||||
6 : "crashed"
|
6 : "crashed"
|
||||||
}
|
}
|
||||||
|
|
||||||
class VMNotFound(Exception):
|
class VMNotFound(Exception):
|
||||||
|
|
|
@ -173,7 +173,7 @@ def _get_glance_client(module, kwargs):
|
||||||
token = _ksclient.auth_token
|
token = _ksclient.auth_token
|
||||||
endpoint =_get_endpoint(module, _ksclient, kwargs.get('endpoint_type'))
|
endpoint =_get_endpoint(module, _ksclient, kwargs.get('endpoint_type'))
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'token': token,
|
'token': token,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
client = glanceclient.Client('1', endpoint, **kwargs)
|
client = glanceclient.Client('1', endpoint, **kwargs)
|
||||||
|
@ -194,12 +194,12 @@ def _glance_image_present(module, params, client):
|
||||||
|
|
||||||
def _glance_image_create(module, params, client):
|
def _glance_image_create(module, params, client):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'name': params.get('name'),
|
'name': params.get('name'),
|
||||||
'disk_format': params.get('disk_format'),
|
'disk_format': params.get('disk_format'),
|
||||||
'container_format': params.get('container_format'),
|
'container_format': params.get('container_format'),
|
||||||
'owner': params.get('owner'),
|
'owner': params.get('owner'),
|
||||||
'is_public': params.get('is_public'),
|
'is_public': params.get('is_public'),
|
||||||
'copy_from': params.get('copy_from'),
|
'copy_from': params.get('copy_from'),
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
timeout = float(params.get('timeout'))
|
timeout = float(params.get('timeout'))
|
||||||
|
|
|
@ -332,19 +332,19 @@ def main():
|
||||||
|
|
||||||
argument_spec = openstack_argument_spec()
|
argument_spec = openstack_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
tenant_description=dict(required=False),
|
tenant_description=dict(required=False),
|
||||||
email=dict(required=False),
|
email=dict(required=False),
|
||||||
user=dict(required=False),
|
user=dict(required=False),
|
||||||
tenant=dict(required=False),
|
tenant=dict(required=False),
|
||||||
password=dict(required=False),
|
password=dict(required=False),
|
||||||
role=dict(required=False),
|
role=dict(required=False),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
endpoint=dict(required=False,
|
endpoint=dict(required=False,
|
||||||
default="http://127.0.0.1:35357/v2.0"),
|
default="http://127.0.0.1:35357/v2.0"),
|
||||||
token=dict(required=False),
|
token=dict(required=False),
|
||||||
login_user=dict(required=False),
|
login_user=dict(required=False),
|
||||||
login_password=dict(required=False),
|
login_password=dict(required=False),
|
||||||
login_tenant_name=dict(required=False)
|
login_tenant_name=dict(required=False)
|
||||||
))
|
))
|
||||||
# keystone operations themselves take an endpoint, not a keystone auth_url
|
# keystone operations themselves take an endpoint, not a keystone auth_url
|
||||||
del(argument_spec['auth_url'])
|
del(argument_spec['auth_url'])
|
||||||
|
|
|
@ -428,12 +428,12 @@ def _create_server(module, nova):
|
||||||
flavor_id = _get_flavor_id(module, nova)
|
flavor_id = _get_flavor_id(module, nova)
|
||||||
bootargs = [module.params['name'], image_id, flavor_id]
|
bootargs = [module.params['name'], image_id, flavor_id]
|
||||||
bootkwargs = {
|
bootkwargs = {
|
||||||
'nics' : module.params['nics'],
|
'nics' : module.params['nics'],
|
||||||
'meta' : module.params['meta'],
|
'meta' : module.params['meta'],
|
||||||
'security_groups': module.params['security_groups'].split(','),
|
'security_groups': module.params['security_groups'].split(','),
|
||||||
#userdata is unhyphenated in novaclient, but hyphenated here for consistency with the ec2 module:
|
#userdata is unhyphenated in novaclient, but hyphenated here for consistency with the ec2 module:
|
||||||
'userdata': module.params['user_data'],
|
'userdata': module.params['user_data'],
|
||||||
'config_drive': module.params['config_drive'],
|
'config_drive': module.params['config_drive'],
|
||||||
}
|
}
|
||||||
|
|
||||||
for optional_param in ('region_name', 'key_name', 'availability_zone', 'scheduler_hints'):
|
for optional_param in ('region_name', 'key_name', 'availability_zone', 'scheduler_hints'):
|
||||||
|
|
|
@ -136,8 +136,8 @@ def _get_neutron_client(module, kwargs):
|
||||||
token = _ksclient.auth_token
|
token = _ksclient.auth_token
|
||||||
endpoint = _get_endpoint(module, _ksclient)
|
endpoint = _get_endpoint(module, _ksclient)
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'token': token,
|
'token': token,
|
||||||
'endpoint_url': endpoint
|
'endpoint_url': endpoint
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
neutron = client.Client('2.0', **kwargs)
|
neutron = client.Client('2.0', **kwargs)
|
||||||
|
@ -174,7 +174,7 @@ def _get_port_info(neutron, module, instance_id, internal_network_name=None):
|
||||||
subnets = neutron.list_subnets(**kwargs)
|
subnets = neutron.list_subnets(**kwargs)
|
||||||
subnet_id = subnets['subnets'][0]['id']
|
subnet_id = subnets['subnets'][0]['id']
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'device_id': instance_id,
|
'device_id': instance_id,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
ports = neutron.list_ports(**kwargs)
|
ports = neutron.list_ports(**kwargs)
|
||||||
|
@ -193,7 +193,7 @@ def _get_port_info(neutron, module, instance_id, internal_network_name=None):
|
||||||
|
|
||||||
def _get_floating_ip(module, neutron, fixed_ip_address, network_name):
|
def _get_floating_ip(module, neutron, fixed_ip_address, network_name):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'fixed_ip_address': fixed_ip_address
|
'fixed_ip_address': fixed_ip_address
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
ips = neutron.list_floatingips(**kwargs)
|
ips = neutron.list_floatingips(**kwargs)
|
||||||
|
@ -214,9 +214,9 @@ def _check_ips_network(neutron, net_id, network_name):
|
||||||
|
|
||||||
def _create_floating_ip(neutron, module, port_id, net_id, fixed_ip):
|
def _create_floating_ip(neutron, module, port_id, net_id, fixed_ip):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'port_id': port_id,
|
'port_id': port_id,
|
||||||
'floating_network_id': net_id,
|
'floating_network_id': net_id,
|
||||||
'fixed_ip_address': fixed_ip
|
'fixed_ip_address': fixed_ip
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
result = neutron.create_floatingip({'floatingip': kwargs})
|
result = neutron.create_floatingip({'floatingip': kwargs})
|
||||||
|
@ -251,10 +251,10 @@ def main():
|
||||||
|
|
||||||
argument_spec = openstack_argument_spec()
|
argument_spec = openstack_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
network_name = dict(required=True),
|
network_name = dict(required=True),
|
||||||
instance_name = dict(required=True),
|
instance_name = dict(required=True),
|
||||||
state = dict(default='present', choices=['absent', 'present']),
|
state = dict(default='present', choices=['absent', 'present']),
|
||||||
internal_network_name = dict(default=None),
|
internal_network_name = dict(default=None),
|
||||||
))
|
))
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -125,8 +125,8 @@ def _get_neutron_client(module, kwargs):
|
||||||
token = _ksclient.auth_token
|
token = _ksclient.auth_token
|
||||||
endpoint = _get_endpoint(module, _ksclient)
|
endpoint = _get_endpoint(module, _ksclient)
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'token': token,
|
'token': token,
|
||||||
'endpoint_url': endpoint
|
'endpoint_url': endpoint
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
neutron = client.Client('2.0', **kwargs)
|
neutron = client.Client('2.0', **kwargs)
|
||||||
|
@ -191,9 +191,9 @@ def main():
|
||||||
|
|
||||||
argument_spec = openstack_argument_spec()
|
argument_spec = openstack_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
ip_address = dict(required=True),
|
ip_address = dict(required=True),
|
||||||
instance_name = dict(required=True),
|
instance_name = dict(required=True),
|
||||||
state = dict(default='present', choices=['absent', 'present'])
|
state = dict(default='present', choices=['absent', 'present'])
|
||||||
))
|
))
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -167,8 +167,8 @@ def _get_neutron_client(module, kwargs):
|
||||||
token = _ksclient.auth_token
|
token = _ksclient.auth_token
|
||||||
endpoint = _get_endpoint(module, _ksclient)
|
endpoint = _get_endpoint(module, _ksclient)
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'token': token,
|
'token': token,
|
||||||
'endpoint_url': endpoint
|
'endpoint_url': endpoint
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
neutron = client.Client('2.0', **kwargs)
|
neutron = client.Client('2.0', **kwargs)
|
||||||
|
@ -192,8 +192,8 @@ def _set_tenant_id(module):
|
||||||
|
|
||||||
def _get_net_id(neutron, module):
|
def _get_net_id(neutron, module):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'tenant_id': _os_tenant_id,
|
'tenant_id': _os_tenant_id,
|
||||||
'name': module.params['name'],
|
'name': module.params['name'],
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
networks = neutron.list_networks(**kwargs)
|
networks = neutron.list_networks(**kwargs)
|
||||||
|
@ -251,15 +251,15 @@ def main():
|
||||||
|
|
||||||
argument_spec = openstack_argument_spec()
|
argument_spec = openstack_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
name = dict(required=True),
|
name = dict(required=True),
|
||||||
tenant_name = dict(default=None),
|
tenant_name = dict(default=None),
|
||||||
provider_network_type = dict(default=None, choices=['local', 'vlan', 'flat', 'gre']),
|
provider_network_type = dict(default=None, choices=['local', 'vlan', 'flat', 'gre']),
|
||||||
provider_physical_network = dict(default=None),
|
provider_physical_network = dict(default=None),
|
||||||
provider_segmentation_id = dict(default=None),
|
provider_segmentation_id = dict(default=None),
|
||||||
router_external = dict(default=False, type='bool'),
|
router_external = dict(default=False, type='bool'),
|
||||||
shared = dict(default=False, type='bool'),
|
shared = dict(default=False, type='bool'),
|
||||||
admin_state_up = dict(default=True, type='bool'),
|
admin_state_up = dict(default=True, type='bool'),
|
||||||
state = dict(default='present', choices=['absent', 'present'])
|
state = dict(default='present', choices=['absent', 'present'])
|
||||||
))
|
))
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
||||||
|
|
|
@ -129,8 +129,8 @@ def _get_neutron_client(module, kwargs):
|
||||||
token = _ksclient.auth_token
|
token = _ksclient.auth_token
|
||||||
endpoint = _get_endpoint(module, _ksclient)
|
endpoint = _get_endpoint(module, _ksclient)
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'token': token,
|
'token': token,
|
||||||
'endpoint_url': endpoint
|
'endpoint_url': endpoint
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
neutron = client.Client('2.0', **kwargs)
|
neutron = client.Client('2.0', **kwargs)
|
||||||
|
@ -154,8 +154,8 @@ def _set_tenant_id(module):
|
||||||
|
|
||||||
def _get_router_id(module, neutron):
|
def _get_router_id(module, neutron):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'name': module.params['name'],
|
'name': module.params['name'],
|
||||||
'tenant_id': _os_tenant_id,
|
'tenant_id': _os_tenant_id,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
routers = neutron.list_routers(**kwargs)
|
routers = neutron.list_routers(**kwargs)
|
||||||
|
@ -167,9 +167,9 @@ def _get_router_id(module, neutron):
|
||||||
|
|
||||||
def _create_router(module, neutron):
|
def _create_router(module, neutron):
|
||||||
router = {
|
router = {
|
||||||
'name': module.params['name'],
|
'name': module.params['name'],
|
||||||
'tenant_id': _os_tenant_id,
|
'tenant_id': _os_tenant_id,
|
||||||
'admin_state_up': module.params['admin_state_up'],
|
'admin_state_up': module.params['admin_state_up'],
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
new_router = neutron.create_router(dict(router=router))
|
new_router = neutron.create_router(dict(router=router))
|
||||||
|
|
|
@ -123,8 +123,8 @@ def _get_neutron_client(module, kwargs):
|
||||||
token = _ksclient.auth_token
|
token = _ksclient.auth_token
|
||||||
endpoint = _get_endpoint(module, _ksclient)
|
endpoint = _get_endpoint(module, _ksclient)
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'token': token,
|
'token': token,
|
||||||
'endpoint_url': endpoint
|
'endpoint_url': endpoint
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
neutron = client.Client('2.0', **kwargs)
|
neutron = client.Client('2.0', **kwargs)
|
||||||
|
@ -134,7 +134,7 @@ def _get_neutron_client(module, kwargs):
|
||||||
|
|
||||||
def _get_router_id(module, neutron):
|
def _get_router_id(module, neutron):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'name': module.params['router_name'],
|
'name': module.params['router_name'],
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
routers = neutron.list_routers(**kwargs)
|
routers = neutron.list_routers(**kwargs)
|
||||||
|
@ -191,9 +191,9 @@ def main():
|
||||||
|
|
||||||
argument_spec = openstack_argument_spec()
|
argument_spec = openstack_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
router_name = dict(required=True),
|
router_name = dict(required=True),
|
||||||
network_name = dict(required=True),
|
network_name = dict(required=True),
|
||||||
state = dict(default='present', choices=['absent', 'present']),
|
state = dict(default='present', choices=['absent', 'present']),
|
||||||
))
|
))
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
if not HAVE_DEPS:
|
if not HAVE_DEPS:
|
||||||
|
|
|
@ -132,8 +132,8 @@ def _get_neutron_client(module, kwargs):
|
||||||
token = _ksclient.auth_token
|
token = _ksclient.auth_token
|
||||||
endpoint = _get_endpoint(module, _ksclient)
|
endpoint = _get_endpoint(module, _ksclient)
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'token': token,
|
'token': token,
|
||||||
'endpoint_url': endpoint
|
'endpoint_url': endpoint
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
neutron = client.Client('2.0', **kwargs)
|
neutron = client.Client('2.0', **kwargs)
|
||||||
|
@ -171,8 +171,8 @@ def _get_router_id(module, neutron):
|
||||||
def _get_subnet_id(module, neutron):
|
def _get_subnet_id(module, neutron):
|
||||||
subnet_id = None
|
subnet_id = None
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'tenant_id': _os_tenant_id,
|
'tenant_id': _os_tenant_id,
|
||||||
'name': module.params['subnet_name'],
|
'name': module.params['subnet_name'],
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
subnets = neutron.list_subnets(**kwargs)
|
subnets = neutron.list_subnets(**kwargs)
|
||||||
|
@ -184,8 +184,8 @@ def _get_subnet_id(module, neutron):
|
||||||
|
|
||||||
def _get_port_id(neutron, module, router_id, subnet_id):
|
def _get_port_id(neutron, module, router_id, subnet_id):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'tenant_id': _os_tenant_id,
|
'tenant_id': _os_tenant_id,
|
||||||
'device_id': router_id,
|
'device_id': router_id,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
ports = neutron.list_ports(**kwargs)
|
ports = neutron.list_ports(**kwargs)
|
||||||
|
@ -222,10 +222,10 @@ def _remove_interface_router(neutron, module, router_id, subnet_id):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = openstack_argument_spec()
|
argument_spec = openstack_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
router_name = dict(required=True),
|
router_name = dict(required=True),
|
||||||
subnet_name = dict(required=True),
|
subnet_name = dict(required=True),
|
||||||
tenant_name = dict(default=None),
|
tenant_name = dict(default=None),
|
||||||
state = dict(default='present', choices=['absent', 'present']),
|
state = dict(default='present', choices=['absent', 'present']),
|
||||||
))
|
))
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
if not HAVE_DEPS:
|
if not HAVE_DEPS:
|
||||||
|
|
|
@ -168,8 +168,8 @@ def _get_neutron_client(module, kwargs):
|
||||||
token = _ksclient.auth_token
|
token = _ksclient.auth_token
|
||||||
endpoint = _get_endpoint(module, _ksclient)
|
endpoint = _get_endpoint(module, _ksclient)
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'token': token,
|
'token': token,
|
||||||
'endpoint_url': endpoint
|
'endpoint_url': endpoint
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
neutron = client.Client('2.0', **kwargs)
|
neutron = client.Client('2.0', **kwargs)
|
||||||
|
@ -227,14 +227,14 @@ def _get_subnet_id(module, neutron):
|
||||||
def _create_subnet(module, neutron):
|
def _create_subnet(module, neutron):
|
||||||
neutron.format = 'json'
|
neutron.format = 'json'
|
||||||
subnet = {
|
subnet = {
|
||||||
'name': module.params['name'],
|
'name': module.params['name'],
|
||||||
'ip_version': module.params['ip_version'],
|
'ip_version': module.params['ip_version'],
|
||||||
'enable_dhcp': module.params['enable_dhcp'],
|
'enable_dhcp': module.params['enable_dhcp'],
|
||||||
'tenant_id': _os_tenant_id,
|
'tenant_id': _os_tenant_id,
|
||||||
'gateway_ip': module.params['gateway_ip'],
|
'gateway_ip': module.params['gateway_ip'],
|
||||||
'dns_nameservers': module.params['dns_nameservers'],
|
'dns_nameservers': module.params['dns_nameservers'],
|
||||||
'network_id': _os_network_id,
|
'network_id': _os_network_id,
|
||||||
'cidr': module.params['cidr'],
|
'cidr': module.params['cidr'],
|
||||||
}
|
}
|
||||||
if module.params['allocation_pool_start'] and module.params['allocation_pool_end']:
|
if module.params['allocation_pool_start'] and module.params['allocation_pool_end']:
|
||||||
allocation_pools = [
|
allocation_pools = [
|
||||||
|
@ -269,17 +269,17 @@ def main():
|
||||||
|
|
||||||
argument_spec = openstack_argument_spec()
|
argument_spec = openstack_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
name = dict(required=True),
|
name = dict(required=True),
|
||||||
network_name = dict(required=True),
|
network_name = dict(required=True),
|
||||||
cidr = dict(required=True),
|
cidr = dict(required=True),
|
||||||
tenant_name = dict(default=None),
|
tenant_name = dict(default=None),
|
||||||
state = dict(default='present', choices=['absent', 'present']),
|
state = dict(default='present', choices=['absent', 'present']),
|
||||||
ip_version = dict(default='4', choices=['4', '6']),
|
ip_version = dict(default='4', choices=['4', '6']),
|
||||||
enable_dhcp = dict(default='true', type='bool'),
|
enable_dhcp = dict(default='true', type='bool'),
|
||||||
gateway_ip = dict(default=None),
|
gateway_ip = dict(default=None),
|
||||||
dns_nameservers = dict(default=None),
|
dns_nameservers = dict(default=None),
|
||||||
allocation_pool_start = dict(default=None),
|
allocation_pool_start = dict(default=None),
|
||||||
allocation_pool_end = dict(default=None),
|
allocation_pool_end = dict(default=None),
|
||||||
))
|
))
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
if not HAVE_DEPS:
|
if not HAVE_DEPS:
|
||||||
|
|
|
@ -64,8 +64,8 @@ def main():
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
changed=False,
|
changed=False,
|
||||||
ansible_facts=dict(
|
ansible_facts=dict(
|
||||||
auth_token=cloud.auth_token,
|
auth_token=cloud.auth_token,
|
||||||
service_catalog=cloud.service_catalog))
|
service_catalog=cloud.service_catalog))
|
||||||
except shade.OpenStackCloudException as e:
|
except shade.OpenStackCloudException as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
|
|
|
@ -345,9 +345,9 @@ def _system_state_change(module, project_quota_output):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
changes_required, quota_change_request = _system_state_change_details(
|
changes_required, quota_change_request = _system_state_change_details(
|
||||||
module,
|
module,
|
||||||
project_quota_output
|
project_quota_output
|
||||||
)
|
)
|
||||||
|
|
||||||
if changes_required:
|
if changes_required:
|
||||||
return True
|
return True
|
||||||
|
@ -452,9 +452,9 @@ def main():
|
||||||
module.exit_json(changed=_system_state_change(module, project_quota_output))
|
module.exit_json(changed=_system_state_change(module, project_quota_output))
|
||||||
|
|
||||||
changes_required, quota_change_request = _system_state_change_details(
|
changes_required, quota_change_request = _system_state_change_details(
|
||||||
module,
|
module,
|
||||||
project_quota_output
|
project_quota_output
|
||||||
)
|
)
|
||||||
|
|
||||||
if changes_required:
|
if changes_required:
|
||||||
for quota_type in quota_change_request.keys():
|
for quota_type in quota_change_request.keys():
|
||||||
|
|
|
@ -215,10 +215,10 @@ def main():
|
||||||
zone, pre_update_recordset)
|
zone, pre_update_recordset)
|
||||||
if changed:
|
if changed:
|
||||||
zone = cloud.update_recordset(
|
zone = cloud.update_recordset(
|
||||||
zone, name + '.' + zone,
|
zone, name + '.' + zone,
|
||||||
records=records,
|
records=records,
|
||||||
description=description,
|
description=description,
|
||||||
ttl=ttl)
|
ttl=ttl)
|
||||||
module.exit_json(changed=changed, recordset=recordset)
|
module.exit_json(changed=changed, recordset=recordset)
|
||||||
|
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
|
|
|
@ -212,9 +212,9 @@ def main():
|
||||||
masters, pre_update_zone)
|
masters, pre_update_zone)
|
||||||
if changed:
|
if changed:
|
||||||
zone = cloud.update_zone(
|
zone = cloud.update_zone(
|
||||||
name, email=email,
|
name, email=email,
|
||||||
description=description,
|
description=description,
|
||||||
ttl=ttl, masters=masters)
|
ttl=ttl, masters=masters)
|
||||||
module.exit_json(changed=changed, zone=zone)
|
module.exit_json(changed=changed, zone=zone)
|
||||||
|
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
|
|
|
@ -202,7 +202,7 @@ def act_on_sshkeys(target_state, module, packet_conn):
|
||||||
raise Exception(_msg)
|
raise Exception(_msg)
|
||||||
matching_sshkeys = []
|
matching_sshkeys = []
|
||||||
new_key_response = packet_conn.create_ssh_key(
|
new_key_response = packet_conn.create_ssh_key(
|
||||||
newkey['label'], newkey['key'])
|
newkey['label'], newkey['key'])
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
matching_sshkeys.append(new_key_response)
|
matching_sshkeys.append(new_key_response)
|
||||||
|
|
|
@ -260,9 +260,9 @@ except ImportError:
|
||||||
def create_virtual_instance(module):
|
def create_virtual_instance(module):
|
||||||
|
|
||||||
instances = vsManager.list_instances(
|
instances = vsManager.list_instances(
|
||||||
hostname = module.params.get('hostname'),
|
hostname = module.params.get('hostname'),
|
||||||
domain = module.params.get('domain'),
|
domain = module.params.get('domain'),
|
||||||
datacenter = module.params.get('datacenter')
|
datacenter = module.params.get('datacenter')
|
||||||
)
|
)
|
||||||
|
|
||||||
if instances:
|
if instances:
|
||||||
|
@ -283,24 +283,24 @@ def create_virtual_instance(module):
|
||||||
tags = ','.join(map(str, module.params.get('tags')))
|
tags = ','.join(map(str, module.params.get('tags')))
|
||||||
|
|
||||||
instance = vsManager.create_instance(
|
instance = vsManager.create_instance(
|
||||||
hostname = module.params.get('hostname'),
|
hostname = module.params.get('hostname'),
|
||||||
domain = module.params.get('domain'),
|
domain = module.params.get('domain'),
|
||||||
cpus = module.params.get('cpus'),
|
cpus = module.params.get('cpus'),
|
||||||
memory = module.params.get('memory'),
|
memory = module.params.get('memory'),
|
||||||
hourly = module.params.get('hourly'),
|
hourly = module.params.get('hourly'),
|
||||||
datacenter = module.params.get('datacenter'),
|
datacenter = module.params.get('datacenter'),
|
||||||
os_code = module.params.get('os_code'),
|
os_code = module.params.get('os_code'),
|
||||||
image_id = module.params.get('image_id'),
|
image_id = module.params.get('image_id'),
|
||||||
local_disk = module.params.get('local_disk'),
|
local_disk = module.params.get('local_disk'),
|
||||||
disks = module.params.get('disks'),
|
disks = module.params.get('disks'),
|
||||||
ssh_keys = module.params.get('ssh_keys'),
|
ssh_keys = module.params.get('ssh_keys'),
|
||||||
nic_speed = module.params.get('nic_speed'),
|
nic_speed = module.params.get('nic_speed'),
|
||||||
private = module.params.get('private'),
|
private = module.params.get('private'),
|
||||||
public_vlan = module.params.get('public_vlan'),
|
public_vlan = module.params.get('public_vlan'),
|
||||||
private_vlan = module.params.get('private_vlan'),
|
private_vlan = module.params.get('private_vlan'),
|
||||||
dedicated = module.params.get('dedicated'),
|
dedicated = module.params.get('dedicated'),
|
||||||
post_uri = module.params.get('post_uri'),
|
post_uri = module.params.get('post_uri'),
|
||||||
tags = tags)
|
tags = tags)
|
||||||
|
|
||||||
if instance is not None and instance['id'] > 0:
|
if instance is not None and instance['id'] > 0:
|
||||||
return True, instance
|
return True, instance
|
||||||
|
@ -349,30 +349,30 @@ def cancel_instance(module):
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
instance_id=dict(),
|
instance_id=dict(),
|
||||||
hostname=dict(),
|
hostname=dict(),
|
||||||
domain=dict(),
|
domain=dict(),
|
||||||
datacenter=dict(choices=DATACENTERS),
|
datacenter=dict(choices=DATACENTERS),
|
||||||
tags=dict(),
|
tags=dict(),
|
||||||
hourly=dict(type='bool', default=True),
|
hourly=dict(type='bool', default=True),
|
||||||
private=dict(type='bool', default=False),
|
private=dict(type='bool', default=False),
|
||||||
dedicated=dict(type='bool', default=False),
|
dedicated=dict(type='bool', default=False),
|
||||||
local_disk=dict(type='bool', default=True),
|
local_disk=dict(type='bool', default=True),
|
||||||
cpus=dict(type='int', choices=CPU_SIZES),
|
cpus=dict(type='int', choices=CPU_SIZES),
|
||||||
memory=dict(type='int', choices=MEMORY_SIZES),
|
memory=dict(type='int', choices=MEMORY_SIZES),
|
||||||
disks=dict(type='list', default=[25]),
|
disks=dict(type='list', default=[25]),
|
||||||
os_code=dict(),
|
os_code=dict(),
|
||||||
image_id=dict(),
|
image_id=dict(),
|
||||||
nic_speed=dict(type='int', choices=NIC_SPEEDS),
|
nic_speed=dict(type='int', choices=NIC_SPEEDS),
|
||||||
public_vlan=dict(),
|
public_vlan=dict(),
|
||||||
private_vlan=dict(),
|
private_vlan=dict(),
|
||||||
ssh_keys=dict(type='list', default=[]),
|
ssh_keys=dict(type='list', default=[]),
|
||||||
post_uri=dict(),
|
post_uri=dict(),
|
||||||
state=dict(default='present', choices=STATES),
|
state=dict(default='present', choices=STATES),
|
||||||
wait=dict(type='bool', default=True),
|
wait=dict(type='bool', default=True),
|
||||||
wait_time=dict(type='int', default=600)
|
wait_time=dict(type='int', default=600)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_SL:
|
if not HAS_SL:
|
||||||
|
|
|
@ -408,9 +408,9 @@ class PyVmomiDeviceHelper(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_scsi_controller(device):
|
def is_scsi_controller(device):
|
||||||
return isinstance(device, vim.vm.device.VirtualLsiLogicController) or \
|
return isinstance(device, vim.vm.device.VirtualLsiLogicController) or \
|
||||||
isinstance(device, vim.vm.device.ParaVirtualSCSIController) or \
|
isinstance(device, vim.vm.device.ParaVirtualSCSIController) or \
|
||||||
isinstance(device, vim.vm.device.VirtualBusLogicController) or \
|
isinstance(device, vim.vm.device.VirtualBusLogicController) or \
|
||||||
isinstance(device, vim.vm.device.VirtualLsiLogicSASController)
|
isinstance(device, vim.vm.device.VirtualLsiLogicSASController)
|
||||||
|
|
||||||
def create_scsi_disk(self, scsi_ctl, disk_index=None):
|
def create_scsi_disk(self, scsi_ctl, disk_index=None):
|
||||||
diskspec = vim.vm.device.VirtualDeviceSpec()
|
diskspec = vim.vm.device.VirtualDeviceSpec()
|
||||||
|
|
|
@ -91,8 +91,8 @@ class VMwareLocalUserManager(object):
|
||||||
try:
|
try:
|
||||||
local_account_manager_states = {
|
local_account_manager_states = {
|
||||||
'absent': {
|
'absent': {
|
||||||
'present': self.state_remove_user,
|
'present': self.state_remove_user,
|
||||||
'absent': self.state_exit_unchanged,
|
'absent': self.state_exit_unchanged,
|
||||||
},
|
},
|
||||||
'present': {
|
'present': {
|
||||||
'present': self.state_update_user,
|
'present': self.state_update_user,
|
||||||
|
|
|
@ -178,8 +178,8 @@ def main():
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
# If this isn't a dry run, create or modify the site
|
# If this isn't a dry run, create or modify the site
|
||||||
result.update(
|
result.update(
|
||||||
webfaction.create_website(
|
webfaction.create_website(
|
||||||
*positional_args
|
*positional_args
|
||||||
) if not existing_site else webfaction.update_website (
|
) if not existing_site else webfaction.update_website (
|
||||||
*positional_args
|
*positional_args
|
||||||
)
|
)
|
||||||
|
|
|
@ -366,18 +366,18 @@ def parse_check(module):
|
||||||
if module.params.get('check_id') or module.params.get('script') or module.params.get('ttl') or module.params.get('http'):
|
if module.params.get('check_id') or module.params.get('script') or module.params.get('ttl') or module.params.get('http'):
|
||||||
|
|
||||||
return ConsulCheck(
|
return ConsulCheck(
|
||||||
module.params.get('check_id'),
|
module.params.get('check_id'),
|
||||||
module.params.get('check_name'),
|
module.params.get('check_name'),
|
||||||
module.params.get('check_node'),
|
module.params.get('check_node'),
|
||||||
module.params.get('check_host'),
|
module.params.get('check_host'),
|
||||||
module.params.get('script'),
|
module.params.get('script'),
|
||||||
module.params.get('interval'),
|
module.params.get('interval'),
|
||||||
module.params.get('ttl'),
|
module.params.get('ttl'),
|
||||||
module.params.get('notes'),
|
module.params.get('notes'),
|
||||||
module.params.get('http'),
|
module.params.get('http'),
|
||||||
module.params.get('timeout'),
|
module.params.get('timeout'),
|
||||||
module.params.get('service_id'),
|
module.params.get('service_id'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def parse_service(module):
|
def parse_service(module):
|
||||||
|
@ -578,7 +578,7 @@ def main():
|
||||||
register_with_consul(module)
|
register_with_consul(module)
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % (
|
module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % (
|
||||||
module.params.get('host'), module.params.get('port'), str(e)))
|
module.params.get('host'), module.params.get('port'), str(e)))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ def load_rules_for_token(module, consul_api, token):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="Could not load rule list from retrieved rule data %s, %s" % (
|
msg="Could not load rule list from retrieved rule data %s, %s" % (
|
||||||
token, e))
|
token, e))
|
||||||
|
|
||||||
return json_to_rules(module, loaded)
|
return json_to_rules(module, loaded)
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ def main():
|
||||||
execute(module)
|
execute(module)
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % (
|
module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % (
|
||||||
module.params.get('host'), module.params.get('port'), str(e)))
|
module.params.get('host'), module.params.get('port'), str(e)))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue