當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。