damex.cloudflare.cloudflare_email_routing_rule module – Ensure Cloudflare email routing rule
Note
This module is part of the damex.cloudflare collection (version 1.2.3).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install damex.cloudflare.
To use it in a playbook, specify: damex.cloudflare.cloudflare_email_routing_rule.
Synopsis
Ensures Cloudflare email routing rules, see the docs: https://developers.cloudflare.com/email-routing/.
Parameters
Parameter |
Comments |
|---|---|
Cloudflare account API key. Required together with |
|
Cloudflare account email. Required together with |
|
Actions to take on matched email. |
|
Action type. Choices:
|
|
Action destination addresses. Required when type is forward or worker. |
|
Cloudflare API token. Required if Can be specified in |
|
Rule enabled state. Choices:
|
|
Matching patterns for incoming email. |
|
Matcher field. Required when type is literal. Choices:
|
|
Matcher type. Choices:
|
|
Matcher value. Required when type is literal. |
|
Rule name. |
|
Rule execution priority. Lower values execute first. |
|
Rule state. Choices:
|
|
Zone identifier. Required if |
|
Zone domain name. Required if Resolved to zone identifier via the Cloudflare API. |
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Supports check mode. |
|
Support: full |
Supports diff mode. |
Examples
- name: Ensure catch-all forwarding rule
damex.cloudflare.cloudflare_email_routing_rule:
name: catch-all
zone_name: example.com
api_token: "{{ cloudflare_api_token }}"
matchers:
- type: all
actions:
- type: forward
value:
- [email protected]
- name: Ensure specific address forwarding rule
damex.cloudflare.cloudflare_email_routing_rule:
name: admin forwarding
zone_name: example.com
api_token: "{{ cloudflare_api_token }}"
matchers:
- type: literal
field: to
value: [email protected]
actions:
- type: forward
value:
- [email protected]
- name: Ensure drop rule
damex.cloudflare.cloudflare_email_routing_rule:
name: drop spam
zone_name: example.com
api_token: "{{ cloudflare_api_token }}"
matchers:
- type: literal
field: to
value: [email protected]
actions:
- type: drop
- name: Ensure rule is absent
damex.cloudflare.cloudflare_email_routing_rule:
name: old-rule
zone_name: example.com
api_token: "{{ cloudflare_api_token }}"
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Routing rule object from the Cloudflare API. Returned: when state is present |
|
Actions to take on matched email. Returned: success |
|
Rule enabled state. Returned: success |
|
Rule identifier. Returned: success |
|
Matching patterns. Returned: success |
|
Rule name. Returned: success |
|
Rule execution priority. Returned: success |