当前位置: 首页>>代码示例>>Python>>正文


Python basic.env_fallback方法代码示例

本文整理汇总了Python中ansible.module_utils.basic.env_fallback方法的典型用法代码示例。如果您正苦于以下问题:Python basic.env_fallback方法的具体用法?Python basic.env_fallback怎么用?Python basic.env_fallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ansible.module_utils.basic的用法示例。


在下文中一共展示了basic.env_fallback方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: vmware_argument_spec

# 需要导入模块: from ansible.module_utils import basic [as 别名]
# 或者: from ansible.module_utils.basic import env_fallback [as 别名]
def vmware_argument_spec():
    return dict(
        hostname=dict(type='str',
                      required=False,
                      fallback=(env_fallback, ['VMWARE_HOST']),
                      ),
        username=dict(type='str',
                      aliases=['user', 'admin'],
                      required=False,
                      fallback=(env_fallback, ['VMWARE_USER'])),
        password=dict(type='str',
                      aliases=['pass', 'pwd'],
                      required=False,
                      no_log=True,
                      fallback=(env_fallback, ['VMWARE_PASSWORD'])),
        port=dict(type='int',
                  default=443,
                  fallback=(env_fallback, ['VMWARE_PORT'])),
        validate_certs=dict(type='bool',
                            required=False,
                            default=True,
                            fallback=(env_fallback, ['VMWARE_VALIDATE_CERTS'])),
    ) 
开发者ID:mgmt-sa-tiger-team,项目名称:skylight,代码行数:25,代码来源:vmware.py

示例2: ecs_argument_spec

# 需要导入模块: from ansible.module_utils import basic [as 别名]
# 或者: from ansible.module_utils.basic import env_fallback [as 别名]
def ecs_argument_spec():
    spec = acs_common_argument_spec()
    spec.update(
        dict(
            alicloud_region=dict(required=True, aliases=['region', 'region_id'],
                                 fallback=(env_fallback, ['ALICLOUD_REGION', 'ALICLOUD_REGION_ID'])),
            alicloud_assume_role_arn=dict(fallback=(env_fallback, ['ALICLOUD_ASSUME_ROLE_ARN']),
                                          aliases=['assume_role_arn']),
            alicloud_assume_role_session_name=dict(fallback=(env_fallback, ['ALICLOUD_ASSUME_ROLE_SESSION_NAME']),
                                                   aliases=['assume_role_session_name']),
            alicloud_assume_role_session_expiration=dict(type='int',
                                                         fallback=(env_fallback,
                                                                   ['ALICLOUD_ASSUME_ROLE_SESSION_EXPIRATION']),
                                                         aliases=['assume_role_session_expiration']),
            alicloud_assume_role=dict(type='dict', aliases=['assume_role']),
            profile=dict(fallback=(env_fallback, ['ALICLOUD_PROFILE'])),
            shared_credentials_file=dict(fallback=(env_fallback, ['ALICLOUD_SHARED_CREDENTIALS_FILE']))
        )
    )
    return spec 
开发者ID:alibaba,项目名称:alibaba.alicloud,代码行数:22,代码来源:alicloud_ecs.py

示例3: main

# 需要导入模块: from ansible.module_utils import basic [as 别名]
# 或者: from ansible.module_utils.basic import env_fallback [as 别名]
def main():
    module = AnsibleModule(
        argument_spec=dict(
            state=dict(choices=['present', 'absent'], default='present'),
            ip=dict(aliases=['id'], required=False),
            region=dict(required=False),
            droplet_id=dict(required=False, type='int'),
            oauth_token=dict(
                no_log=True,
                # Support environment variable for DigitalOcean OAuth Token
                fallback=(env_fallback, ['DO_API_TOKEN', 'DO_API_KEY', 'DO_OAUTH_TOKEN']),
                required=True,
            ),
            validate_certs=dict(type='bool', default=True),
            timeout=dict(type='int', default=30),
        ),
        required_if=[
            ('state', 'delete', ['ip'])
        ],
        mutually_exclusive=[
            ['region', 'droplet_id']
        ],
    )

    core(module) 
开发者ID:trailofbits,项目名称:algo,代码行数:27,代码来源:digital_ocean_floating_ip.py

示例4: acs_common_argument_spec

# 需要导入模块: from ansible.module_utils import basic [as 别名]
# 或者: from ansible.module_utils.basic import env_fallback [as 别名]
def acs_common_argument_spec():
    return dict(
        alicloud_access_key=dict(aliases=['access_key_id', 'access_key'], no_log=True,
                                 fallback=(env_fallback, ['ALICLOUD_ACCESS_KEY', 'ALICLOUD_ACCESS_KEY_ID'])),
        alicloud_secret_key=dict(aliases=['secret_access_key', 'secret_key'], no_log=True,
                                 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']))
    ) 
开发者ID:alibaba,项目名称:alibaba.alicloud,代码行数:12,代码来源:alicloud_ecs.py

示例5: vmanage_argument_spec

# 需要导入模块: from ansible.module_utils import basic [as 别名]
# 或者: from ansible.module_utils.basic import env_fallback [as 别名]
def vmanage_argument_spec():
    return dict(host=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_HOST'])),
                port=dict(type='str', required=False, fallback=(env_fallback, ['VMANAGE_PORT'])),
                user=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_USERNAME'])),
                password=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_PASSWORD'])),
                validate_certs=dict(type='bool', required=False, default=False),
                timeout=dict(type='int', default=30)
                ) 
开发者ID:CiscoDevNet,项目名称:python-viptela,代码行数:10,代码来源:vmanage.py

示例6: viptela_argument_spec

# 需要导入模块: from ansible.module_utils import basic [as 别名]
# 或者: from ansible.module_utils.basic import env_fallback [as 别名]
def viptela_argument_spec():
    return dict(host=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_HOST'])),
                port=dict(type='str', required=False, fallback=(env_fallback, ['VMANAGE_PORT'])),
                user=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_USERNAME'])),
                password=dict(type='str', required=True, fallback=(env_fallback, ['VMANAGE_PASSWORD'])),
                validate_certs=dict(type='bool', required=False, default=False),
                timeout=dict(type='int', default=30)
                ) 
开发者ID:CiscoDevNet,项目名称:python-viptela,代码行数:10,代码来源:viptela.py

示例7: f5_argument_spec

# 需要导入模块: from ansible.module_utils import basic [as 别名]
# 或者: from ansible.module_utils.basic import env_fallback [as 别名]
def f5_argument_spec():
    return dict(
        server=dict(
            type='str',
            required=True,
            fallback=(env_fallback, ['F5_SERVER'])
        ),
        user=dict(
            type='str',
            required=True,
            fallback=(env_fallback, ['F5_USER'])
        ),
        password=dict(
            type='str',
            aliases=['pass', 'pwd'],
            required=True,
            no_log=True,
            fallback=(env_fallback, ['F5_PASSWORD'])
        ),
        validate_certs=dict(
            default='yes',
            type='bool',
            fallback=(env_fallback, ['F5_VALIDATE_CERTS'])
        ),
        server_port=dict(
            type='int',
            default=443,
            fallback=(env_fallback, ['F5_SERVER_PORT'])
        ),
        state=dict(
            type='str',
            default='present',
            choices=['present', 'absent']
        ),
        partition=dict(
            type='str',
            default='Common',
            fallback=(env_fallback, ['F5_PARTITION'])
        )
    ) 
开发者ID:mcgonagle,项目名称:ansible_f5,代码行数:42,代码来源:f5_utils.py

示例8: __init__

# 需要导入模块: from ansible.module_utils import basic [as 别名]
# 或者: from ansible.module_utils.basic import env_fallback [as 别名]
def __init__(self, argument_spec, attributes, resource, **kwargs):
        self.headers = {"Content-Type": "application/json"}
        # List of attributes from the upstream specification
        self.attributes = attributes
        # The type of resource to work with. i.e.: checks, handlers, etc.
        self.resource = resource
        args = dict(
            name=dict(type='str', required=True),
            host=dict(
                type='str',
                required=True,
                fallback=(env_fallback, ['ANSIBLE_SENSU_GO_HOST'])
            ),
            port=dict(
                type='int',
                default=8080,
                fallback=(env_fallback, ['ANSIBLE_SENSU_GO_PORT'])
            ),
            protocol=dict(
                type='str',
                default='http',
                choices=['http', 'https'],
                fallback=(env_fallback, ['ANSIBLE_SENSU_GO_PROTOCOL'])
            ),
            url_username=dict(
                type='str',
                default='admin',
                aliases=['username'],
                fallback=(env_fallback, ['ANSIBLE_SENSU_GO_USERNAME'])
            ),
            url_password=dict(
                type='str',
                default='P@ssw0rd!',
                no_log=True,
                aliases=['password'],
                fallback=(env_fallback, ['ANSIBLE_SENSU_GO_PASSWORD'])
            ),
            namespace=dict(type='str', default='default'),
            validate_certs=dict(type='bool', default=True),
        )
        argument_spec.update(args)
        super(SensuGo, self).__init__(argument_spec=argument_spec, **kwargs) 
开发者ID:jaredledvina,项目名称:sensu-go-ansible,代码行数:44,代码来源:sensu_go.py

示例9: __init__

# 需要导入模块: from ansible.module_utils import basic [as 别名]
# 或者: from ansible.module_utils.basic import env_fallback [as 别名]
def __init__(self, *args, **kwargs):
        arg_spec = {}
        if 'argument_spec' in kwargs:
            arg_spec = kwargs['argument_spec']

        kwargs['argument_spec'] = self._merge_dictionaries(
            arg_spec,
            dict(
                project=dict(
                    required=False,
                    type='str',
                    fallback=(env_fallback, ['GCP_PROJECT'])),
                auth_kind=dict(
                    required=True,
                    fallback=(env_fallback, ['GCP_AUTH_KIND']),
                    choices=['machineaccount', 'serviceaccount', 'application'],
                    type='str'),
                service_account_email=dict(
                    required=False,
                    fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_EMAIL']),
                    type='str'),
                service_account_file=dict(
                    required=False,
                    fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_FILE']),
                    type='path'),
                service_account_contents=dict(
                    required=False,
                    fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_CONTENTS']),
                    no_log=True,
                    type='jsonarg'),
                scopes=dict(
                    required=False,
                    fallback=(env_fallback, ['GCP_SCOPES']),
                    type='list'),
                env_type=dict(
                    required=False,
                    fallback=(env_fallback, ['GCP_ENV_TYPE']),
                    type='str')
            )
        )

        mutual = []
        if 'mutually_exclusive' in kwargs:
            mutual = kwargs['mutually_exclusive']

        kwargs['mutually_exclusive'] = mutual.append(
            ['service_account_email', 'service_account_file', 'service_account_contents']
        )

        AnsibleModule.__init__(self, *args, **kwargs) 
开发者ID:ansible-collections,项目名称:google.cloud,代码行数:52,代码来源:gcp_utils.py


注:本文中的ansible.module_utils.basic.env_fallback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。