From 608a783a921928377131562392cced42caf21b06 Mon Sep 17 00:00:00 2001 From: lixue <1120722567@qq.com> Date: Wed, 6 May 2020 16:23:58 +0800 Subject: [PATCH] support https --- lib/ansible/module_utils/alicloud_ecs.py | 6 ++++-- lib/ansible/modules/cloud/alicloud/ali_vpc.py | 6 ++---- lib/ansible/utils/module_docs_fragments/alicloud.py | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/ansible/module_utils/alicloud_ecs.py b/lib/ansible/module_utils/alicloud_ecs.py index 53f36bad..ddc443e3 100644 --- a/lib/ansible/module_utils/alicloud_ecs.py +++ b/lib/ansible/module_utils/alicloud_ecs.py @@ -60,7 +60,8 @@ def acs_common_argument_spec(): fallback=(env_fallback, ['ALICLOUD_SECRET_KEY', 'ALICLOUD_SECRET_ACCESS_KEY'])), alicloud_security_token=dict(aliases=['security_token'], no_log=True, fallback=(env_fallback, ['ALICLOUD_SECURITY_TOKEN'])), - ecs_role_name=dict(aliases=['role_name'], fallback=(env_fallback, ['ALICLOUD_ECS_ROLE_NAME'])) + ecs_role_name=dict(aliases=['role_name'], fallback=(env_fallback, ['ALICLOUD_ECS_ROLE_NAME'])), + alicloud_protocol=dict(aliases=['protocol'], fallback=(env_fallback, ['ALICLOUD_PROTOCOL']), default='https') ) @@ -92,7 +93,8 @@ def get_acs_connection_info(params): acs_secret_access_key=params.get('alicloud_secret_key'), security_token=params.get('alicloud_security_token'), ecs_role_name=params.get('ecs_role_name'), - user_agent='Ansible-Provider-Alicloud') + user_agent='Ansible-Provider-Alicloud', + alicloud_protocol=params.get('alicloud_protocol')) return ecs_params diff --git a/lib/ansible/modules/cloud/alicloud/ali_vpc.py b/lib/ansible/modules/cloud/alicloud/ali_vpc.py index 14deb3bf..74ff6d22 100644 --- a/lib/ansible/modules/cloud/alicloud/ali_vpc.py +++ b/lib/ansible/modules/cloud/alicloud/ali_vpc.py @@ -48,7 +48,6 @@ It cannot begin with http:// or https://. This is used in combination with C(cidr_block) to determine if a VPC already exists. aliases: ['vpc_name'] - required: True type: str vpc_id: description: @@ -63,7 +62,6 @@ description: - The primary CIDR of the VPC. This is used in conjunction with the C(name) to ensure idempotence. aliases: ['cidr'] - required: True type: str user_cidrs: description: @@ -244,9 +242,9 @@ def main(): argument_spec = ecs_argument_spec() argument_spec.update(dict( state=dict(default='present', choices=['present', 'absent']), - cidr_block=dict(type='str', required=True, aliases=['cidr']), + cidr_block=dict(type='str', aliases=['cidr']), user_cidrs=dict(type='list', elements='str'), - name=dict(type='str', required=True, aliases=['vpc_name']), + name=dict(type='str', aliases=['vpc_name']), vpc_id=dict(type='str', aliases=['id']), multi_ok=dict(type='bool', default=False), description=dict(type='str'), diff --git a/lib/ansible/utils/module_docs_fragments/alicloud.py b/lib/ansible/utils/module_docs_fragments/alicloud.py index 3c9294c4..2088c21c 100644 --- a/lib/ansible/utils/module_docs_fragments/alicloud.py +++ b/lib/ansible/utils/module_docs_fragments/alicloud.py @@ -83,6 +83,12 @@ class ModuleDocFragment(object): environment variable. - If this is not set and a profile is specified, ~/.aliyun/config.json will be used. type: str + alicloud_protocol: + description: + - The type of protocol. + type: str + aliases: ['protocol'] + default: https author: - "He Guimin (@xiaozhu36)" requirements: