Debian Codegraph @

ansible_collections/azure/azcollection/plugins/doc_fragments/azure_plugin.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 # Copyright: (c) 2016 Matt Davis, <[email protected]>
4 # Copyright: (c) 2016 Chris Houseknecht, <[email protected]>
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 from __future__ import absolute_import, division, print_function
8 __metaclass__ = type
9
10
11 class ModuleDocFragment(object):
12
13 # Azure doc fragment
14 DOCUMENTATION = r'''
15
16 options:
17 subscription_id:
18 description:
19 - Your Azure subscription Id.
20 type: str
21 env:
22 - name: AZURE_SUBSCRIPTION_ID
23 client_id:
24 description:
25 - Azure client ID. Use when authenticating with a Service Principal or Managed Identity (msi).
26 - Can also be set via the C(AZURE_CLIENT_ID) environment variable.
27 type: str
28 env:
29 - name: AZURE_CLIENT_ID
30 secret:
31 description:
32 - Azure client secret. Use when authenticating with a Service Principal.
33 type: str
34 env:
35 - name: AZURE_SECRET
36 tenant:
37 description:
38 - Azure tenant ID. Use when authenticating with a Service Principal.
39 type: str
40 env:
41 - name: AZURE_TENANT
42 oidc_token:
43 description:
44 - Direct OpenID Connect (OIDC) token (JWT) used for workload identity authentication.
45 type: str
46 env:
47 - name: AZURE_FEDERATED_TOKEN
48 oidc_token_file_path:
49 description:
50 - Path to a file containing an OpenID Connect (OIDC) token (JWT) used for workload identity authentication.
51 type: path
52 env:
53 - name: AZURE_FEDERATED_TOKEN_FILE
54 cloud_environment:
55 description:
56 - For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, C(AzureChinaCloud),
57 C(AzureUSGovernment)), or a resource manager URL (required for Azure Stack). Can also be set via credential file profile or
58 the C(AZURE_CLOUD_ENVIRONMENT) environment variable. If setting to a URL, you must also set the ARM_CLOUD_METADATA_URL if the cloud
59 is not registered with azcli.
60 type: str
61 default: AzureCloud
62 version_added: '0.0.1'
63 env:
64 - name: AZURE_CLOUD_ENVIRONMENT
65 auth_source:
66 description:
67 - Controls the source of the credentials to use for authentication.
68 - Can also be set via the C(ANSIBLE_AZURE_AUTH_SOURCE) environment variable.
69 - When set to C(auto) (the default) the precedence is module parameters -> C(env) -> C(credential_file) -> C(cli).
70 - When set to C(env), the credentials will be read from the environment variables
71 - When set to C(cli), the credentials will be sources from the Azure CLI profile. C(subscription_id) or the environment variable
72 C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if more than one is present otherwise the default
73 az cli subscription is used.
74 - When set to C(msi), the host machine must be an azure resource with an enabled MSI extension. C(subscription_id) or the
75 environment variable C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if the resource is granted
76 access to more than one subscription, otherwise the first subscription is chosen.
77 - The C(msi) was added in Ansible 2.6.
78 type: str
79 default: auto
80 choices:
81 - auto
82 - cli
83 - env
84 - msi
85 env:
86 - name: ANSIBLE_AZURE_AUTH_SOURCE
87 requirements:
88 - python >= 2.7
89 - The host that executes this module must have the azure.azcollection collection installed via galaxy
90 - All python packages listed in collection's requirements.txt must be installed via pip on the host that executes modules from azure.azcollection
91 - Full installation instructions may be found https://galaxy.ansible.com/azure/azcollection
92
93 notes:
94 - For authentication with Azure you can pass parameters, set environment variables, use a profile stored
95 in ~/.azure/credentials, or log in before you run your tasks or playbook with C(az login).
96 - Authentication is also possible using a service principal.
97 - To authenticate via OIDC, pass client_id, tenant and oidc_token or oidc_token_file_path, or set environment
98 variables AZURE_CLIENT_ID, AZURE_TENANT and AZURE_FEDERATED_TOKEN or AZURE_FEDERATED_TOKEN_FILE.
99 - To authenticate via service principal, pass subscription_id, client_id, secret and tenant or set environment
100 variables AZURE_SUBSCRIPTION_ID, AZURE_CLIENT_ID, AZURE_SECRET and AZURE_TENANT.
101 - "Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing
102 a [default] section and the following keys: subscription_id, client_id, secret and tenant."
103
104 seealso:
105 - name: Sign in with Azure CLI
106 link: https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest
107 description: How to authenticate using the C(az login) command.
108 '''