mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudflare_dns: read API token from environment (#1238)
* cloudflare_dns: read API token from environment * Update plugins/modules/net_tools/cloudflare_dns.py Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * Update plugins/modules/net_tools/cloudflare_dns.py Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
parent
01c892ddf1
commit
740883e7fd
2 changed files with 15 additions and 7 deletions
2
changelogs/fragments/cloudflare_dns.yml
Normal file
2
changelogs/fragments/cloudflare_dns.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- cloudflare_dns - add support for environment variable ``CLOUDFLARE_TOKEN`` (https://github.com/ansible-collections/community.general/pull/1238).
|
|
@ -16,13 +16,14 @@ requirements:
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
short_description: Manage Cloudflare DNS records
|
short_description: Manage Cloudflare DNS records
|
||||||
description:
|
description:
|
||||||
- "Manages dns records via the Cloudflare API, see the docs: U(https://api.cloudflare.com/)"
|
- "Manages dns records via the Cloudflare API, see the docs: U(https://api.cloudflare.com/)."
|
||||||
options:
|
options:
|
||||||
api_token:
|
api_token:
|
||||||
description:
|
description:
|
||||||
- API token.
|
- API token.
|
||||||
- Required for api token authentication.
|
- Required for api token authentication.
|
||||||
- "You can obtain your API token from the bottom of the Cloudflare 'My Account' page, found here: U(https://dash.cloudflare.com/)"
|
- "You can obtain your API token from the bottom of the Cloudflare 'My Account' page, found here: U(https://dash.cloudflare.com/)."
|
||||||
|
- Can be specified in C(CLOUDFLARE_TOKEN) environment variable since community.general 2.0.0.
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
version_added: '0.2.0'
|
version_added: '0.2.0'
|
||||||
|
@ -30,13 +31,13 @@ options:
|
||||||
description:
|
description:
|
||||||
- Account API key.
|
- Account API key.
|
||||||
- Required for api keys authentication.
|
- Required for api keys authentication.
|
||||||
- "You can obtain your API key from the bottom of the Cloudflare 'My Account' page, found here: U(https://dash.cloudflare.com/)"
|
- "You can obtain your API key from the bottom of the Cloudflare 'My Account' page, found here: U(https://dash.cloudflare.com/)."
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
aliases: [ account_api_token ]
|
aliases: [ account_api_token ]
|
||||||
account_email:
|
account_email:
|
||||||
description:
|
description:
|
||||||
- Account email. Required for api keys authentication.
|
- Account email. Required for API keys authentication.
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
algorithm:
|
algorithm:
|
||||||
|
@ -100,7 +101,7 @@ options:
|
||||||
service:
|
service:
|
||||||
description:
|
description:
|
||||||
- Record service.
|
- Record service.
|
||||||
- Required for C(type=SRV)
|
- Required for I(type=SRV).
|
||||||
type: str
|
type: str
|
||||||
solo:
|
solo:
|
||||||
description:
|
description:
|
||||||
|
@ -357,7 +358,7 @@ record:
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule, env_fallback
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||||
from ansible.module_utils._text import to_native, to_text
|
from ansible.module_utils._text import to_native, to_text
|
||||||
from ansible.module_utils.urls import fetch_url
|
from ansible.module_utils.urls import fetch_url
|
||||||
|
@ -788,7 +789,12 @@ class CloudflareAPI(object):
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
api_token=dict(type='str', required=False, no_log=True),
|
api_token=dict(
|
||||||
|
type="str",
|
||||||
|
required=False,
|
||||||
|
no_log=True,
|
||||||
|
fallback=(env_fallback, ["CLOUDFLARE_TOKEN"]),
|
||||||
|
),
|
||||||
account_api_key=dict(type='str', required=False, no_log=True, aliases=['account_api_token']),
|
account_api_key=dict(type='str', required=False, no_log=True, aliases=['account_api_token']),
|
||||||
account_email=dict(type='str', required=False),
|
account_email=dict(type='str', required=False),
|
||||||
algorithm=dict(type='int'),
|
algorithm=dict(type='int'),
|
||||||
|
|
Loading…
Reference in a new issue