From 9a7e23569e92cbc997e97d5122448cdfe78d7927 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sat, 12 Aug 2017 02:06:11 -0700 Subject: [PATCH] Fix wildcard imports, remove get_exception, add boilerplate Amazon modules that don't have open PRs against them --- .../modules/cloud/amazon/_ec2_ami_search.py | 20 +++-------- .../modules/cloud/amazon/_ec2_remote_facts.py | 19 ++++------ lib/ansible/modules/cloud/amazon/_ec2_vpc.py | 28 ++++++--------- .../modules/cloud/amazon/aws_api_gateway.py | 27 +++++--------- .../cloud/amazon/aws_s3_bucket_facts.py | 25 +++++-------- .../cloud/amazon/cloudformation_facts.py | 31 +++++++--------- .../modules/cloud/amazon/cloudtrail.py | 32 +++++++---------- .../cloud/amazon/cloudwatchevent_rule.py | 36 +++++++++---------- .../modules/cloud/amazon/data_pipeline.py | 16 +++++---- .../modules/cloud/amazon/dynamodb_table.py | 20 ++++------- .../modules/cloud/amazon/dynamodb_ttl.py | 33 ++++++----------- .../modules/cloud/amazon/ec2_asg_facts.py | 28 ++++++--------- .../modules/cloud/amazon/ec2_group_facts.py | 31 ++++++---------- .../cloud/amazon/ec2_instance_facts.py | 35 ++++++++---------- .../modules/cloud/amazon/ec2_lc_facts.py | 28 ++++++--------- .../modules/cloud/amazon/ec2_lc_find.py | 28 +++++---------- .../cloud/amazon/ec2_metadata_facts.py | 26 +++++--------- .../cloud/amazon/ec2_snapshot_facts.py | 22 ++++-------- lib/ansible/modules/cloud/amazon/ec2_tag.py | 26 +++++--------- .../modules/cloud/amazon/ec2_vol_facts.py | 19 ++++------ .../cloud/amazon/ec2_vpc_dhcp_options.py | 19 +++------- .../amazon/ec2_vpc_dhcp_options_facts.py | 29 ++++++--------- .../modules/cloud/amazon/ec2_vpc_endpoint.py | 32 +++++++---------- .../cloud/amazon/ec2_vpc_endpoint_facts.py | 29 +++++---------- .../modules/cloud/amazon/ec2_vpc_igw.py | 19 ++++------ .../modules/cloud/amazon/ec2_vpc_igw_facts.py | 29 ++++++--------- .../modules/cloud/amazon/ec2_vpc_nacl.py | 21 ++++------- .../cloud/amazon/ec2_vpc_nacl_facts.py | 31 +++++++--------- .../cloud/amazon/ec2_vpc_nat_gateway.py | 29 ++++++--------- .../cloud/amazon/ec2_vpc_nat_gateway_facts.py | 28 ++++++--------- .../modules/cloud/amazon/ec2_vpc_peer.py | 27 +++++--------- .../cloud/amazon/ec2_vpc_peering_facts.py | 29 ++++++--------- .../cloud/amazon/ec2_vpc_route_table_facts.py | 19 ++++------ .../modules/cloud/amazon/ec2_vpc_subnet.py | 29 ++++++--------- .../modules/cloud/amazon/ec2_vpc_vgw.py | 20 ++++------- .../modules/cloud/amazon/ec2_vpc_vgw_facts.py | 30 ++++++---------- .../modules/cloud/amazon/ec2_win_password.py | 32 ++++++++--------- .../amazon/iam_server_certificate_facts.py | 27 +++++--------- 38 files changed, 360 insertions(+), 649 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/_ec2_ami_search.py b/lib/ansible/modules/cloud/amazon/_ec2_ami_search.py index ab3f7a2b5d..78eb691593 100644 --- a/lib/ansible/modules/cloud/amazon/_ec2_ami_search.py +++ b/lib/ansible/modules/cloud/amazon/_ec2_ami_search.py @@ -1,21 +1,11 @@ #!/usr/bin/python # # (c) 2013, Nimbis Services -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['deprecated'], diff --git a/lib/ansible/modules/cloud/amazon/_ec2_remote_facts.py b/lib/ansible/modules/cloud/amazon/_ec2_remote_facts.py index 4e508ff75d..a37e7ee078 100644 --- a/lib/ansible/modules/cloud/amazon/_ec2_remote_facts.py +++ b/lib/ansible/modules/cloud/amazon/_ec2_remote_facts.py @@ -1,17 +1,10 @@ #!/usr/bin/python -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['deprecated'], diff --git a/lib/ansible/modules/cloud/amazon/_ec2_vpc.py b/lib/ansible/modules/cloud/amazon/_ec2_vpc.py index 3306820782..388b692ec7 100644 --- a/lib/ansible/modules/cloud/amazon/_ec2_vpc.py +++ b/lib/ansible/modules/cloud/amazon/_ec2_vpc.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['deprecated'], @@ -167,10 +159,10 @@ EXAMPLES = ''' # the delete will fail until those dependencies are removed. ''' - import time try: + import boto import boto.ec2 import boto.vpc from boto.exception import EC2ResponseError @@ -179,6 +171,9 @@ try: except ImportError: HAS_BOTO = False +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import connect_to_aws, ec2_argument_spec, get_aws_connection_info + def get_vpc_info(vpc): """ @@ -761,9 +756,6 @@ def main(): module.exit_json(changed=changed, vpc_id=new_vpc_id, vpc=vpc_dict, igw_id=igw_id, subnets=subnets_changed) -# import module snippets -from ansible.module_utils.basic import * -from ansible.module_utils.ec2 import * if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/amazon/aws_api_gateway.py b/lib/ansible/modules/cloud/amazon/aws_api_gateway.py index cfe4aa2269..6f4dcc0644 100644 --- a/lib/ansible/modules/cloud/amazon/aws_api_gateway.py +++ b/lib/ansible/modules/cloud/amazon/aws_api_gateway.py @@ -1,18 +1,9 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type ANSIBLE_METADATA = {'status': ['preview'], @@ -115,10 +106,6 @@ output: ''' import json -from ansible.module_utils.basic import AnsibleModule, traceback -from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info, boto3_conn, camel_dict_to_snake_dict, AWSRetry - -from ansible.module_utils.ec2 import HAS_BOTO3 try: import botocore @@ -126,6 +113,10 @@ try: except ImportError: HAS_BOTOCORE = False +from ansible.module_utils.basic import AnsibleModule, traceback +from ansible.module_utils.ec2 import (AWSRetry, HAS_BOTO3, ec2_argument_spec, get_aws_connection_info, + boto3_conn, camel_dict_to_snake_dict) + def main(): argument_spec = ec2_argument_spec() diff --git a/lib/ansible/modules/cloud/amazon/aws_s3_bucket_facts.py b/lib/ansible/modules/cloud/amazon/aws_s3_bucket_facts.py index f014d246a6..6e9ce9ed50 100644 --- a/lib/ansible/modules/cloud/amazon/aws_s3_bucket_facts.py +++ b/lib/ansible/modules/cloud/amazon/aws_s3_bucket_facts.py @@ -1,17 +1,10 @@ #!/usr/bin/python # Copyright (c) 2017 Ansible Project -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -54,15 +47,15 @@ buckets: import traceback -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import boto3_conn, ec2_argument_spec, HAS_BOTO3, camel_dict_to_snake_dict, \ - get_aws_connection_info - try: import botocore except ImportError: pass # will be detected by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (boto3_conn, ec2_argument_spec, HAS_BOTO3, camel_dict_to_snake_dict, + get_aws_connection_info) + def get_bucket_list(module, connection): """ diff --git a/lib/ansible/modules/cloud/amazon/cloudformation_facts.py b/lib/ansible/modules/cloud/amazon/cloudformation_facts.py index 84b49b2a3d..8a57f133c5 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation_facts.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation_facts.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -145,6 +137,10 @@ stack_resources: type: dict ''' +import json +import traceback +from functools import partial + try: import boto3 import botocore @@ -152,12 +148,9 @@ try: except ImportError: HAS_BOTO3 = False -from ansible.module_utils.ec2 import get_aws_connection_info, ec2_argument_spec, boto3_conn, camel_dict_to_snake_dict, \ - AWSRetry, boto3_tag_list_to_ansible_dict from ansible.module_utils.basic import AnsibleModule -from functools import partial -import json -import traceback +from ansible.module_utils.ec2 import (get_aws_connection_info, ec2_argument_spec, boto3_conn, + camel_dict_to_snake_dict, AWSRetry, boto3_tag_list_to_ansible_dict) class CloudFormationServiceManager: diff --git a/lib/ansible/modules/cloud/amazon/cloudtrail.py b/lib/ansible/modules/cloud/amazon/cloudtrail.py index e84fc7ffae..7d631f3c88 100644 --- a/lib/ansible/modules/cloud/amazon/cloudtrail.py +++ b/lib/ansible/modules/cloud/amazon/cloudtrail.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -252,14 +244,14 @@ trail: ''' import traceback -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import boto3_conn, ec2_argument_spec -from ansible.module_utils.ec2 import get_aws_connection_info, HAS_BOTO3 -from ansible.module_utils.ec2 import ansible_dict_to_boto3_tag_list -from ansible.module_utils.ec2 import boto3_tag_list_to_ansible_dict -from ansible.module_utils.ec2 import camel_dict_to_snake_dict + from botocore.exceptions import ClientError +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (boto3_conn, ec2_argument_spec, get_aws_connection_info, + HAS_BOTO3, ansible_dict_to_boto3_tag_list, + boto3_tag_list_to_ansible_dict, camel_dict_to_snake_dict) + def create_trail(module, client, ct_params): """ diff --git a/lib/ansible/modules/cloud/amazon/cloudwatchevent_rule.py b/lib/ansible/modules/cloud/amazon/cloudwatchevent_rule.py index cc94a066c6..4fad146f87 100644 --- a/lib/ansible/modules/cloud/amazon/cloudwatchevent_rule.py +++ b/lib/ansible/modules/cloud/amazon/cloudwatchevent_rule.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -119,6 +111,17 @@ targets: sample: "[{ 'arn': 'arn:aws:lambda:us-east-1:123456789012:function:MyFunction', 'id': 'MyTargetId' }]" ''' # NOQA +try: + import boto3.exception + import botocore.exceptions +except ImportError: + # module_utils.ec2.HAS_BOTO3 will do the right thing + pass + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (HAS_BOTO3, boto3_conn, camel_dict_to_snake_dict, + ec2_argument_spec, get_aws_connection_info) + class CloudWatchEventRule(object): def __init__(self, module, name, client, schedule_expression=None, @@ -407,10 +410,5 @@ def main(): module.exit_json(**cwe_rule_manager.fetch_aws_state()) -# import module snippets -from ansible.module_utils.basic import * -from ansible.module_utils.ec2 import * - - if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/amazon/data_pipeline.py b/lib/ansible/modules/cloud/amazon/data_pipeline.py index ae574bf33b..49e37baa85 100644 --- a/lib/ansible/modules/cloud/amazon/data_pipeline.py +++ b/lib/ansible/modules/cloud/amazon/data_pipeline.py @@ -1,9 +1,12 @@ #!/usr/bin/python # # Copyright (c) 2017 Ansible Project -# # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import absolute_import, division, print_function +__metaclass__ = type + + ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadata_version': '1.0'} @@ -153,14 +156,9 @@ result: ''' import hashlib -import traceback -import re import json import time - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info, boto3_conn, camel_dict_to_snake_dict -from ansible.module_utils._text import to_bytes, to_text +import traceback try: import boto3 @@ -169,6 +167,10 @@ try: except ImportError: HAS_BOTO3 = False +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info, boto3_conn, camel_dict_to_snake_dict +from ansible.module_utils._text import to_text + DP_ACTIVE_STATES = ['ACTIVE', 'SCHEDULED'] DP_INACTIVE_STATES = ['INACTIVE', 'PENDING', 'FINISHED', 'DELETING'] diff --git a/lib/ansible/modules/cloud/amazon/dynamodb_table.py b/lib/ansible/modules/cloud/amazon/dynamodb_table.py index 2d36af3446..946e88c61a 100644 --- a/lib/ansible/modules/cloud/amazon/dynamodb_table.py +++ b/lib/ansible/modules/cloud/amazon/dynamodb_table.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], diff --git a/lib/ansible/modules/cloud/amazon/dynamodb_ttl.py b/lib/ansible/modules/cloud/amazon/dynamodb_ttl.py index f03cac5911..2f59a7901d 100644 --- a/lib/ansible/modules/cloud/amazon/dynamodb_ttl.py +++ b/lib/ansible/modules/cloud/amazon/dynamodb_ttl.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -74,21 +66,18 @@ current_status: - { "AttributeName": "deploy_timestamp", "Enabled": true } ''' -# import module snippets -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, camel_dict_to_snake_dict, HAS_BOTO3 - -# import a class, otherwise we'll use a fully qualified path -import ansible.module_utils.ec2 - -import traceback import distutils.version +import traceback try: import botocore except ImportError: pass +import ansible.module_utils.ec2 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import ec2_argument_spec, camel_dict_to_snake_dict, HAS_BOTO3 + def get_current_ttl_state(c, table_name): '''Fetch the state dict for a table.''' diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg_facts.py b/lib/ansible/modules/cloud/amazon/ec2_asg_facts.py index d1fdb9be57..317422ccdd 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg_facts.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -224,10 +216,6 @@ termination_policies: sample: ["Default"] ''' -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import get_aws_connection_info, boto3_conn, ec2_argument_spec -from ansible.module_utils.ec2 import camel_dict_to_snake_dict, HAS_BOTO3 - import re try: @@ -235,6 +223,10 @@ try: except ImportError: pass # caught by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (get_aws_connection_info, boto3_conn, ec2_argument_spec, + camel_dict_to_snake_dict, HAS_BOTO3) + def match_asg_tags(tags_to_match, asg): for key, value in tags_to_match.items(): diff --git a/lib/ansible/modules/cloud/amazon/ec2_group_facts.py b/lib/ansible/modules/cloud/amazon/ec2_group_facts.py index a204a7aa82..06dabf7c49 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_group_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_group_facts.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -98,18 +90,17 @@ security_groups: sample: ''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, boto3_conn, HAS_BOTO3 -from ansible.module_utils.ec2 import get_aws_connection_info, boto3_tag_list_to_ansible_dict -from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, camel_dict_to_snake_dict +import traceback try: from botocore.exceptions import ClientError except ImportError: pass # caught by imported HAS_BOTO3 -import traceback +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ec2_argument_spec, boto3_conn, HAS_BOTO3, get_aws_connection_info, + boto3_tag_list_to_ansible_dict, ansible_dict_to_boto3_filter_list, + camel_dict_to_snake_dict) def main(): diff --git a/lib/ansible/modules/cloud/amazon/ec2_instance_facts.py b/lib/ansible/modules/cloud/amazon/ec2_instance_facts.py index c223c069cc..55aaee7402 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_instance_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_instance_facts.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -473,18 +465,19 @@ instances: ''' import traceback + +try: + import boto3 + from botocore.exceptions import ClientError + HAS_BOTO3 = True +except ImportError: + HAS_BOTO3 = False + from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.ec2 import (ansible_dict_to_boto3_filter_list, boto3_conn, boto3_tag_list_to_ansible_dict, camel_dict_to_snake_dict, ec2_argument_spec, get_aws_connection_info) -try: - import boto3 - from botocore.exceptions import ClientError, NoCredentialsError - HAS_BOTO3 = True -except ImportError: - HAS_BOTO3 = False - def list_ec2_instances(connection, module): diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc_facts.py b/lib/ansible/modules/cloud/amazon/ec2_lc_facts.py index d04231c3f7..6b7ffbb465 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_lc_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc_facts.py @@ -1,18 +1,11 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -165,12 +158,14 @@ user_data: try: import boto3 - from botocore.exceptions import ClientError, NoCredentialsError + from botocore.exceptions import ClientError HAS_BOTO3 = True except ImportError: HAS_BOTO3 = False -from ansible.module_utils.ec2 import paging +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (HAS_BOTO3, boto3_conn, camel_dict_to_snake_dict, ec2_argument_spec, + get_aws_connection_info, paging) def list_launch_configs(connection, module): @@ -239,9 +234,6 @@ def main(): list_launch_configs(connection, module) -# import module snippets -from ansible.module_utils.basic import * -from ansible.module_utils.ec2 import * if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc_find.py b/lib/ansible/modules/cloud/amazon/ec2_lc_find.py index 85be55f9f1..7e8786903f 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_lc_find.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc_find.py @@ -2,21 +2,11 @@ # encoding: utf-8 # (c) 2015, Jose Armesto -# -# This file is part of Ansible -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -151,6 +141,10 @@ associate_public_address: sample: True ... ''' +import re + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import boto3_conn, ec2_argument_spec, get_aws_connection_info def find_launch_configs(client, module): @@ -222,9 +216,5 @@ def main(): find_launch_configs(client, module) -# import module snippets -from ansible.module_utils.basic import * -from ansible.module_utils.ec2 import * - if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py b/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py index e915f7bf05..ba400bff86 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py @@ -1,20 +1,11 @@ #!/usr/bin/python # -*- coding: utf-8 -*- +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], @@ -424,14 +415,15 @@ ansible_facts: sample: "#!/bin/bash" ''' -import socket -import re import json +import re +import socket -from ansible.module_utils._text import to_text from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text from ansible.module_utils.urls import fetch_url, url_argument_spec + socket.setdefaulttimeout(5) diff --git a/lib/ansible/modules/cloud/amazon/ec2_snapshot_facts.py b/lib/ansible/modules/cloud/amazon/ec2_snapshot_facts.py index 5af4dae10a..f693de2793 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_snapshot_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_snapshot_facts.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -179,7 +171,7 @@ data_encryption_key_id: try: import boto3 - from botocore.exceptions import ClientError, NoCredentialsError + from botocore.exceptions import ClientError HAS_BOTO3 = True except ImportError: HAS_BOTO3 = False diff --git a/lib/ansible/modules/cloud/amazon/ec2_tag.py b/lib/ansible/modules/cloud/amazon/ec2_tag.py index 3937592d95..a088a8f744 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_tag.py +++ b/lib/ansible/modules/cloud/amazon/ec2_tag.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], @@ -127,6 +119,9 @@ try: except ImportError: HAS_BOTO = False +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import HAS_BOTO, ec2_argument_spec, ec2_connect + def main(): argument_spec = ec2_argument_spec() @@ -190,9 +185,6 @@ def main(): if state == 'list': module.exit_json(changed=False, tags=tagdict) -# import module snippets -from ansible.module_utils.basic import * -from ansible.module_utils.ec2 import * if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/amazon/ec2_vol_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vol_facts.py index f22acfacb0..8081458fa2 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vol_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vol_facts.py @@ -1,17 +1,10 @@ #!/usr/bin/python -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py index 1d2a8454d7..5e4392426c 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py @@ -1,17 +1,10 @@ #!/usr/bin/python +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], @@ -208,12 +201,10 @@ EXAMPLES = """ """ import collections -import socket import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.ec2 import HAS_BOTO, connect_to_aws, ec2_argument_spec, get_aws_connection_info -from ansible.module_utils._text import to_native if HAS_BOTO: import boto.vpc diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options_facts.py index 96f166c2b6..36f2346394 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options_facts.py @@ -1,17 +1,10 @@ #!/usr/bin/python -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -86,16 +79,16 @@ changed: import traceback -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, boto3_conn, HAS_BOTO3 -from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, get_aws_connection_info -from ansible.module_utils.ec2 import camel_dict_to_snake_dict, boto3_tag_list_to_ansible_dict - try: import botocore except ImportError: pass # caught by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ec2_argument_spec, boto3_conn, HAS_BOTO3, + ansible_dict_to_boto3_filter_list, get_aws_connection_info, + camel_dict_to_snake_dict, boto3_tag_list_to_ansible_dict) + def get_dhcp_options_info(dhcp_option): dhcp_option_info = {'DhcpOptionsId': dhcp_option['DhcpOptionsId'], diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_endpoint.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_endpoint.py index 169282a1e7..94ccd4f94d 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_endpoint.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_endpoint.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', @@ -181,16 +173,16 @@ import json import time import traceback -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import get_aws_connection_info, boto3_conn, ec2_argument_spec, HAS_BOTO3 -from ansible.module_utils.ec2 import camel_dict_to_snake_dict -from ansible.module_utils.six import string_types - try: import botocore except ImportError: pass # will be picked up by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (get_aws_connection_info, boto3_conn, ec2_argument_spec, HAS_BOTO3, + camel_dict_to_snake_dict) +from ansible.module_utils.six import string_types + def date_handler(obj): return obj.isoformat() if hasattr(obj, 'isoformat') else obj @@ -198,7 +190,7 @@ def date_handler(obj): def wait_for_status(client, module, resource_id, status): polling_increment_secs = 15 - max_retries = (module.params.get('wait_timeout') / polling_increment_secs) + max_retries = (module.params.get('wait_timeout') // polling_increment_secs) status_achieved = False for x in range(0, max_retries): diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_endpoint_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_endpoint_facts.py index 6505414cdf..727d8d3e56 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_endpoint_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_endpoint_facts.py @@ -1,18 +1,9 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -118,17 +109,15 @@ vpc_endpoints: import json -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, boto3_conn, get_aws_connection_info -from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, HAS_BOTO3 -from ansible.module_utils.ec2 import camel_dict_to_snake_dict - - try: import botocore except ImportError: pass # will be picked up from imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ec2_argument_spec, boto3_conn, get_aws_connection_info, + ansible_dict_to_boto3_filter_list, HAS_BOTO3, camel_dict_to_snake_dict) + def date_handler(obj): return obj.isoformat() if hasattr(obj, 'isoformat') else obj diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py index e98f3041a0..9a688cab7f 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_igw.py @@ -1,17 +1,10 @@ #!/usr/bin/python -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_igw_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_igw_facts.py index 692ddb813a..399b8d2836 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_igw_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_igw_facts.py @@ -1,17 +1,10 @@ #!/usr/bin/python -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -98,17 +91,15 @@ changed: sample: "false" ''' -# import module snippets -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info -from ansible.module_utils.ec2 import boto3_conn, camel_dict_to_snake_dict -from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, HAS_BOTO3 - try: import botocore except ImportError: pass # will be captured by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ec2_argument_spec, get_aws_connection_info, boto3_conn, + camel_dict_to_snake_dict, ansible_dict_to_boto3_filter_list, HAS_BOTO3) + def get_internet_gateway_info(internet_gateway): internet_gateway_info = {'InternetGatewayId': internet_gateway['InternetGatewayId'], diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py index b6c5890d1a..7f52ed9404 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py @@ -1,18 +1,11 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], 'supported_by': 'curated'} diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl_facts.py index 23529a2faf..62ba90450d 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl_facts.py @@ -1,18 +1,9 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], @@ -103,16 +94,17 @@ nacl: type: list of list ''' -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, boto3_conn, get_aws_connection_info -from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, HAS_BOTO3 -from ansible.module_utils.ec2 import camel_dict_to_snake_dict, boto3_tag_list_to_ansible_dict - try: from botocore.exceptions import ClientError, NoCredentialsError except ImportError: pass # caught by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ec2_argument_spec, boto3_conn, get_aws_connection_info, + ansible_dict_to_boto3_filter_list, HAS_BOTO3, + camel_dict_to_snake_dict, boto3_tag_list_to_ansible_dict) + + # VPC-supported IANA protocol numbers # http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml PROTOCOL_NAMES = {'-1': 'all', '1': 'icmp', '6': 'tcp', '17': 'udp'} @@ -202,5 +194,6 @@ def main(): list_ec2_vpc_nacls(connection, module) + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py index 279be66e2c..d0f1487b58 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -210,10 +202,6 @@ nat_gateway_addresses: ] ''' -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info, boto3_conn -from ansible.module_utils.ec2 import camel_dict_to_snake_dict, HAS_BOTO3 - import datetime import random import time @@ -223,6 +211,11 @@ try: except ImportError: pass # caught by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ec2_argument_spec, get_aws_connection_info, boto3_conn, + camel_dict_to_snake_dict, HAS_BOTO3) + + DRY_RUN_GATEWAYS = [ { "nat_gateway_id": "nat-123456789", diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway_facts.py index c533cc13f4..b5fe09c26c 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway_facts.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -90,15 +82,15 @@ result: import json -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info, boto3_conn, camel_dict_to_snake_dict -from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, HAS_BOTO3 - try: import botocore except ImportError: pass # will be detected by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ec2_argument_spec, get_aws_connection_info, boto3_conn, + camel_dict_to_snake_dict, ansible_dict_to_boto3_filter_list, HAS_BOTO3) + def date_handler(obj): return obj.isoformat() if hasattr(obj, 'isoformat') else obj diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_peer.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_peer.py index 09524b7d70..fc7dc49c96 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_peer.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_peer.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], @@ -194,15 +186,14 @@ task: type: dictionary ''' -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import boto3_conn, ec2_argument_spec -from ansible.module_utils.ec2 import get_aws_connection_info, HAS_BOTO3 - try: import botocore except ImportError: pass # caught by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import boto3_conn, ec2_argument_spec, get_aws_connection_info, HAS_BOTO3 + def tags_changed(pcx_id, client, module): changed = False diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_peering_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_peering_facts.py index 6443287022..86420141d6 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_peering_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_peering_facts.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -78,16 +70,15 @@ result: import json -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, boto3_conn, get_aws_connection_info -from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, HAS_BOTO3 -from ansible.module_utils.ec2 import camel_dict_to_snake_dict - try: import botocore except ImportError: pass # will be picked up by imported HAS_BOTO3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ec2_argument_spec, boto3_conn, get_aws_connection_info, + ansible_dict_to_boto3_filter_list, HAS_BOTO3, camel_dict_to_snake_dict) + def date_handler(obj): return obj.isoformat() if hasattr(obj, 'isoformat') else obj diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py index 3cb3ab4cfa..c808e9f101 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py @@ -1,17 +1,10 @@ #!/usr/bin/python -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py index bb0c25b9e9..db622bda5a 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py @@ -1,17 +1,10 @@ #!/usr/bin/python -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], @@ -89,16 +82,16 @@ EXAMPLES = ''' import time import traceback -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, ansible_dict_to_boto3_tag_list, ec2_argument_spec -from ansible.module_utils.ec2 import camel_dict_to_snake_dict, get_aws_connection_info -from ansible.module_utils.ec2 import boto3_conn, boto3_tag_list_to_ansible_dict, HAS_BOTO3 - try: import botocore except ImportError: pass # caught by imported boto3 +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ansible_dict_to_boto3_filter_list, ansible_dict_to_boto3_tag_list, + ec2_argument_spec, camel_dict_to_snake_dict, get_aws_connection_info, + boto3_conn, boto3_tag_list_to_ansible_dict, HAS_BOTO3) + def get_subnet_info(subnet): if 'Subnets' in subnet: diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py index 121652b27a..bf8ee76cdd 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw_facts.py index 48b7bd3f6b..b7353e9578 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_vgw_facts.py @@ -1,17 +1,10 @@ #!/usr/bin/python -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -100,18 +93,17 @@ changed: type: bool sample: "false" ''' - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info -from ansible.module_utils.ec2 import boto3_conn, camel_dict_to_snake_dict -from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, HAS_BOTO3 +import traceback try: import botocore except ImportError: pass # will be captured by imported HAS_BOTO3 -import traceback +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import (ec2_argument_spec, get_aws_connection_info, boto3_conn, + camel_dict_to_snake_dict, ansible_dict_to_boto3_filter_list, HAS_BOTO3) + def get_virtual_gateway_info(virtual_gateway): virtual_gateway_info = {'VpnGatewayId': virtual_gateway['VpnGatewayId'], diff --git a/lib/ansible/modules/cloud/amazon/ec2_win_password.py b/lib/ansible/modules/cloud/amazon/ec2_win_password.py index af60d97d6d..1e93805eaa 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_win_password.py +++ b/lib/ansible/modules/cloud/amazon/ec2_win_password.py @@ -1,17 +1,10 @@ #!/usr/bin/python -# -# This is a free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This Ansible library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this library. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -101,9 +94,10 @@ tasks: wait_timeout: 45 ''' -from base64 import b64decode -from os.path import expanduser import datetime +import time +from base64 import b64decode + from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric.padding import PKCS1v15 from cryptography.hazmat.primitives.serialization import load_pem_private_key @@ -114,6 +108,11 @@ try: except ImportError: HAS_BOTO = False +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import HAS_BOTO, ec2_argument_spec, ec2_connect +from ansible.module_utils._text import to_bytes + + BACKEND = default_backend() @@ -183,9 +182,6 @@ def main(): else: module.exit_json(win_password=decrypted, changed=True) -# import module snippets -from ansible.module_utils.basic import * -from ansible.module_utils.ec2 import * if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/amazon/iam_server_certificate_facts.py b/lib/ansible/modules/cloud/amazon/iam_server_certificate_facts.py index c0f21ec5c5..172c28b275 100644 --- a/lib/ansible/modules/cloud/amazon/iam_server_certificate_facts.py +++ b/lib/ansible/modules/cloud/amazon/iam_server_certificate_facts.py @@ -1,18 +1,10 @@ #!/usr/bin/python -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], @@ -97,6 +89,9 @@ try: except ImportError: HAS_BOTO3 = False +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.ec2 import boto3_conn, ec2_argument_spec, get_aws_connection_info + def get_server_certs(iam, name=None): """Retrieve the attributes of a server certificate if it exists or all certs. @@ -170,9 +165,5 @@ def main(): module.exit_json(results=results) -# import module snippets -from ansible.module_utils.basic import * -from ansible.module_utils.ec2 import * - if __name__ == '__main__': main()