damex.cloudflare.cloudflare_email_routing role – Ensure Cloudflare email routing.

Note

This role 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.

Entry point main – Ensure Cloudflare email routing.

Synopsis

  • Ensure Cloudflare email routing destination addresses, settings, and rules.

Parameters

Parameter

Comments

cloudflare_email_routing_account_api_key

string

Cloudflare account API key.

cloudflare_email_routing_account_email

string

Cloudflare account email.

cloudflare_email_routing_account_id

string

Cloudflare account identifier.

cloudflare_email_routing_account_name

string

Cloudflare account name.

cloudflare_email_routing_api_token

string

Cloudflare API token.

cloudflare_email_routing_destination_addresses

list / elements=string / required

Destination email addresses to ensure.

cloudflare_email_routing_enabled

boolean

Email routing enabled state.

Choices:

  • false

  • true

cloudflare_email_routing_rule_enabled

boolean

Default rule enabled state.

Choices:

  • false

  • true

cloudflare_email_routing_rule_state

string

Default rule state.

Choices:

  • "absent"

  • "present"

cloudflare_email_routing_rules

list / elements=dictionary / required

Routing rules to ensure.

actions

list / elements=dictionary / required

Actions to take on matched email.

type

string / required

Action type.

Choices:

  • "drop"

  • "forward"

  • "worker"

value

list / elements=string

Action destination addresses.

enabled

boolean

Rule enabled state.

Choices:

  • false

  • true

matchers

list / elements=dictionary / required

Matching patterns.

field

string

Matcher field.

Choices:

  • "to"

type

string / required

Matcher type.

Choices:

  • "all"

  • "literal"

value

string

Matcher value.

name

string / required

Rule name.

priority

integer

Rule execution priority.

state

string

Rule state.

Choices:

  • "absent"

  • "present"

cloudflare_email_routing_zone_id

string

Zone identifier.

cloudflare_email_routing_zone_name

string

Zone domain name.

Examples

- name: Ensure cloudflare email routing
  hosts: all
  tasks:
    - name: Ensure cloudflare email routing
      ansible.builtin.import_role:
        name: damex.cloudflare.cloudflare_email_routing
      vars:
        cloudflare_email_routing_zone_name: example.com
        cloudflare_email_routing_account_id: 023e105f4ecef8ad9ca31a8372d0c353
        cloudflare_email_routing_api_token: "{{ cloudflare_api_token }}"
        cloudflare_email_routing_destination_addresses:
          - user@gmail.com
        cloudflare_email_routing_rules:
          - name: catch-all
            matchers:
              - type: all
            actions:
              - type: forward
                value:
                  - user@gmail.com