| 1 |
# -*- coding: utf-8 -*- |
| 2 |
|
| 3 |
# Copyright: (c) 2021, Brian Scholer (@briantist) |
| 4 |
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 5 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 6 |
|
| 7 |
from __future__ import (absolute_import, division, print_function) |
| 8 |
__metaclass__ = type |
| 9 |
|
| 10 |
|
| 11 |
class ModuleDocFragment(object): |
| 12 |
|
| 13 |
DOCUMENTATION = r''' |
| 14 |
options: |
| 15 |
auth_method: |
| 16 |
description: |
| 17 |
- Authentication method to be used. |
| 18 |
- C(none) auth method was added in collection version C(1.2.0). |
| 19 |
- C(cert) auth method was added in collection version C(1.4.0). |
| 20 |
- C(aws_iam_login) was renamed C(aws_iam) in collection version C(2.1.0) and was removed in C(3.0.0). |
| 21 |
- C(azure) auth method was added in collection version C(3.2.0). |
| 22 |
- C(gcp) auth method was added in collection version C(7.1.0). |
| 23 |
choices: |
| 24 |
- token |
| 25 |
- userpass |
| 26 |
- ldap |
| 27 |
- approle |
| 28 |
- aws_iam |
| 29 |
- azure |
| 30 |
- jwt |
| 31 |
- cert |
| 32 |
- gcp |
| 33 |
- none |
| 34 |
default: token |
| 35 |
type: str |
| 36 |
mount_point: |
| 37 |
description: |
| 38 |
- Vault mount point. |
| 39 |
- If not specified, the default mount point for a given auth method is used. |
| 40 |
- Does not apply to token authentication. |
| 41 |
type: str |
| 42 |
token: |
| 43 |
description: |
| 44 |
- Vault token. Token may be specified explicitly, through the listed [env] vars, and also through the C(VAULT_TOKEN) env var. |
| 45 |
- If no token is supplied, explicitly or through env, then the plugin will check for a token file, as determined by I(token_path) and I(token_file). |
| 46 |
- The order of token loading (first found wins) is C(token param -> ansible var -> ANSIBLE_HASHI_VAULT_TOKEN -> VAULT_TOKEN -> token file). |
| 47 |
type: str |
| 48 |
token_path: |
| 49 |
description: If no token is specified, will try to read the I(token_file) from this path. |
| 50 |
type: str |
| 51 |
token_file: |
| 52 |
description: If no token is specified, will try to read the token from this file in I(token_path). |
| 53 |
default: '.vault-token' |
| 54 |
type: str |
| 55 |
token_validate: |
| 56 |
description: |
| 57 |
- For token auth, will perform a C(lookup-self) operation to determine the token's validity before using it. |
| 58 |
- Disable if your token does not have the C(lookup-self) capability. |
| 59 |
type: bool |
| 60 |
default: false |
| 61 |
version_added: 0.2.0 |
| 62 |
username: |
| 63 |
description: Authentication user name. |
| 64 |
type: str |
| 65 |
password: |
| 66 |
description: Authentication password. |
| 67 |
type: str |
| 68 |
role_id: |
| 69 |
description: |
| 70 |
- Vault Role ID or name. Used in C(approle), C(aws_iam), C(azure) and C(cert) auth methods. |
| 71 |
- For C(cert) auth, if no I(role_id) is supplied, the default behavior is to try all certificate roles and return any one that matches. |
| 72 |
- For C(azure) auth, I(role_id) is required. |
| 73 |
type: str |
| 74 |
secret_id: |
| 75 |
description: Secret ID to be used for Vault AppRole authentication. |
| 76 |
type: str |
| 77 |
jwt: |
| 78 |
description: The JSON Web Token (JWT) to use for JWT authentication to Vault. |
| 79 |
type: str |
| 80 |
aws_profile: |
| 81 |
description: The AWS profile |
| 82 |
type: str |
| 83 |
aliases: [ boto_profile ] |
| 84 |
aws_access_key: |
| 85 |
description: The AWS access key to use. |
| 86 |
type: str |
| 87 |
aliases: [ aws_access_key_id ] |
| 88 |
aws_secret_key: |
| 89 |
description: The AWS secret key that corresponds to the access key. |
| 90 |
type: str |
| 91 |
aliases: [ aws_secret_access_key ] |
| 92 |
aws_security_token: |
| 93 |
description: The AWS security token if using temporary access and secret keys. |
| 94 |
type: str |
| 95 |
region: |
| 96 |
description: The AWS region for which to create the connection. |
| 97 |
type: str |
| 98 |
aws_iam_server_id: |
| 99 |
description: If specified, sets the value to use for the C(X-Vault-AWS-IAM-Server-ID) header as part of C(GetCallerIdentity) request. |
| 100 |
required: False |
| 101 |
type: str |
| 102 |
version_added: '0.2.0' |
| 103 |
azure_tenant_id: |
| 104 |
description: |
| 105 |
- The Azure Active Directory Tenant ID (also known as the Directory ID) of the service principal. Should be a UUID. |
| 106 |
- >- |
| 107 |
Required when using a service principal to authenticate to Vault, |
| 108 |
e.g. required when both I(azure_client_id) and I(azure_client_secret) are specified. |
| 109 |
- Optional when using managed identity to authenticate to Vault. |
| 110 |
required: False |
| 111 |
type: str |
| 112 |
version_added: '3.2.0' |
| 113 |
azure_client_id: |
| 114 |
description: |
| 115 |
- The client ID (also known as application ID) of the Azure AD service principal or managed identity. Should be a UUID. |
| 116 |
- If not specified, will use the system assigned managed identity. |
| 117 |
required: False |
| 118 |
type: str |
| 119 |
version_added: '3.2.0' |
| 120 |
azure_client_secret: |
| 121 |
description: The client secret of the Azure AD service principal. |
| 122 |
required: False |
| 123 |
type: str |
| 124 |
version_added: '3.2.0' |
| 125 |
azure_resource: |
| 126 |
description: The resource URL for the application registered in Azure Active Directory. Usually should not be changed from the default. |
| 127 |
required: False |
| 128 |
type: str |
| 129 |
default: https://management.azure.com/ |
| 130 |
version_added: '3.2.0' |
| 131 |
cert_auth_public_key: |
| 132 |
description: For C(cert) auth, path to the certificate file to authenticate with, in PEM format. |
| 133 |
type: path |
| 134 |
version_added: 1.4.0 |
| 135 |
cert_auth_private_key: |
| 136 |
description: For C(cert) auth, path to the private key file to authenticate with, in PEM format. |
| 137 |
type: path |
| 138 |
version_added: 1.4.0 |
| 139 |
''' |
| 140 |
|
| 141 |
PLUGINS = r''' |
| 142 |
options: |
| 143 |
auth_method: |
| 144 |
env: |
| 145 |
- name: ANSIBLE_HASHI_VAULT_AUTH_METHOD |
| 146 |
version_added: 0.2.0 |
| 147 |
ini: |
| 148 |
- section: hashi_vault_collection |
| 149 |
key: auth_method |
| 150 |
version_added: 1.4.0 |
| 151 |
vars: |
| 152 |
- name: ansible_hashi_vault_auth_method |
| 153 |
version_added: 1.2.0 |
| 154 |
mount_point: |
| 155 |
env: |
| 156 |
- name: ANSIBLE_HASHI_VAULT_MOUNT_POINT |
| 157 |
version_added: 1.5.0 |
| 158 |
ini: |
| 159 |
- section: hashi_vault_collection |
| 160 |
key: mount_point |
| 161 |
version_added: 1.5.0 |
| 162 |
vars: |
| 163 |
- name: ansible_hashi_vault_mount_point |
| 164 |
version_added: 1.5.0 |
| 165 |
token: |
| 166 |
env: |
| 167 |
- name: ANSIBLE_HASHI_VAULT_TOKEN |
| 168 |
version_added: 0.2.0 |
| 169 |
vars: |
| 170 |
- name: ansible_hashi_vault_token |
| 171 |
version_added: 1.2.0 |
| 172 |
token_path: |
| 173 |
env: |
| 174 |
- name: ANSIBLE_HASHI_VAULT_TOKEN_PATH |
| 175 |
version_added: 0.2.0 |
| 176 |
ini: |
| 177 |
- section: hashi_vault_collection |
| 178 |
key: token_path |
| 179 |
version_added: 1.4.0 |
| 180 |
vars: |
| 181 |
- name: ansible_hashi_vault_token_path |
| 182 |
version_added: 1.2.0 |
| 183 |
token_file: |
| 184 |
env: |
| 185 |
- name: ANSIBLE_HASHI_VAULT_TOKEN_FILE |
| 186 |
version_added: 0.2.0 |
| 187 |
ini: |
| 188 |
- section: hashi_vault_collection |
| 189 |
key: token_file |
| 190 |
version_added: 1.4.0 |
| 191 |
vars: |
| 192 |
- name: ansible_hashi_vault_token_file |
| 193 |
version_added: 1.2.0 |
| 194 |
token_validate: |
| 195 |
env: |
| 196 |
- name: ANSIBLE_HASHI_VAULT_TOKEN_VALIDATE |
| 197 |
ini: |
| 198 |
- section: hashi_vault_collection |
| 199 |
key: token_validate |
| 200 |
version_added: 1.4.0 |
| 201 |
vars: |
| 202 |
- name: ansible_hashi_vault_token_validate |
| 203 |
version_added: 1.2.0 |
| 204 |
username: |
| 205 |
env: |
| 206 |
- name: ANSIBLE_HASHI_VAULT_USERNAME |
| 207 |
version_added: '1.2.0' |
| 208 |
vars: |
| 209 |
- name: ansible_hashi_vault_username |
| 210 |
version_added: '1.2.0' |
| 211 |
password: |
| 212 |
env: |
| 213 |
- name: ANSIBLE_HASHI_VAULT_PASSWORD |
| 214 |
version_added: '1.2.0' |
| 215 |
vars: |
| 216 |
- name: ansible_hashi_vault_password |
| 217 |
version_added: '1.2.0' |
| 218 |
role_id: |
| 219 |
env: |
| 220 |
- name: ANSIBLE_HASHI_VAULT_ROLE_ID |
| 221 |
version_added: 0.2.0 |
| 222 |
ini: |
| 223 |
- section: hashi_vault_collection |
| 224 |
key: role_id |
| 225 |
version_added: 1.4.0 |
| 226 |
vars: |
| 227 |
- name: ansible_hashi_vault_role_id |
| 228 |
version_added: 1.2.0 |
| 229 |
secret_id: |
| 230 |
env: |
| 231 |
- name: ANSIBLE_HASHI_VAULT_SECRET_ID |
| 232 |
version_added: 0.2.0 |
| 233 |
vars: |
| 234 |
- name: ansible_hashi_vault_secret_id |
| 235 |
version_added: 1.2.0 |
| 236 |
jwt: |
| 237 |
env: |
| 238 |
- name: ANSIBLE_HASHI_VAULT_JWT |
| 239 |
aws_profile: |
| 240 |
env: |
| 241 |
- name: AWS_DEFAULT_PROFILE |
| 242 |
- name: AWS_PROFILE |
| 243 |
aws_access_key: |
| 244 |
env: |
| 245 |
- name: EC2_ACCESS_KEY |
| 246 |
- name: AWS_ACCESS_KEY |
| 247 |
- name: AWS_ACCESS_KEY_ID |
| 248 |
aws_secret_key: |
| 249 |
env: |
| 250 |
- name: EC2_SECRET_KEY |
| 251 |
- name: AWS_SECRET_KEY |
| 252 |
- name: AWS_SECRET_ACCESS_KEY |
| 253 |
aws_security_token: |
| 254 |
env: |
| 255 |
- name: EC2_SECURITY_TOKEN |
| 256 |
- name: AWS_SESSION_TOKEN |
| 257 |
- name: AWS_SECURITY_TOKEN |
| 258 |
region: |
| 259 |
env: |
| 260 |
- name: EC2_REGION |
| 261 |
- name: AWS_REGION |
| 262 |
aws_iam_server_id: |
| 263 |
env: |
| 264 |
- name: ANSIBLE_HASHI_VAULT_AWS_IAM_SERVER_ID |
| 265 |
ini: |
| 266 |
- section: hashi_vault_collection |
| 267 |
key: aws_iam_server_id |
| 268 |
version_added: 1.4.0 |
| 269 |
azure_tenant_id: |
| 270 |
env: |
| 271 |
- name: ANSIBLE_HASHI_VAULT_AZURE_TENANT_ID |
| 272 |
ini: |
| 273 |
- section: hashi_vault_collection |
| 274 |
key: azure_tenant_id |
| 275 |
vars: |
| 276 |
- name: ansible_hashi_vault_azure_tenant_id |
| 277 |
azure_client_id: |
| 278 |
env: |
| 279 |
- name: ANSIBLE_HASHI_VAULT_AZURE_CLIENT_ID |
| 280 |
ini: |
| 281 |
- section: hashi_vault_collection |
| 282 |
key: azure_client_id |
| 283 |
vars: |
| 284 |
- name: ansible_hashi_vault_azure_client_id |
| 285 |
azure_client_secret: |
| 286 |
env: |
| 287 |
- name: ANSIBLE_HASHI_VAULT_AZURE_CLIENT_SECRET |
| 288 |
vars: |
| 289 |
- name: ansible_hashi_vault_azure_client_secret |
| 290 |
azure_resource: |
| 291 |
env: |
| 292 |
- name: ANSIBLE_HASHI_VAULT_AZURE_RESOURCE |
| 293 |
ini: |
| 294 |
- section: hashi_vault_collection |
| 295 |
key: azure_resource |
| 296 |
vars: |
| 297 |
- name: ansible_hashi_vault_azure_resource |
| 298 |
cert_auth_public_key: |
| 299 |
env: |
| 300 |
- name: ANSIBLE_HASHI_VAULT_CERT_AUTH_PUBLIC_KEY |
| 301 |
vars: |
| 302 |
- name: ansible_hashi_vault_cert_auth_public_key |
| 303 |
version_added: 6.2.0 |
| 304 |
ini: |
| 305 |
- section: hashi_vault_collection |
| 306 |
key: cert_auth_public_key |
| 307 |
cert_auth_private_key: |
| 308 |
env: |
| 309 |
- name: ANSIBLE_HASHI_VAULT_CERT_AUTH_PRIVATE_KEY |
| 310 |
vars: |
| 311 |
- name: ansible_hashi_vault_cert_auth_private_key |
| 312 |
version_added: 6.2.0 |
| 313 |
ini: |
| 314 |
- section: hashi_vault_collection |
| 315 |
key: cert_auth_private_key |
| 316 |
''' |