damex.cloudflare.cloudflare_r2_buckets role – Ensure Cloudflare R2 buckets.

Note

This role is part of the damex.cloudflare collection (version 1.1.1).

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_r2_buckets.

Entry point main – Ensure Cloudflare R2 buckets.

Synopsis

  • Ensure Cloudflare R2 object storage buckets.

Parameters

Parameter

Comments

cloudflare_r2_buckets

list / elements=dictionary / required

R2 buckets to ensure.

account_api_key

string

Cloudflare account API key.

account_email

string

Cloudflare account email.

account_id

string

Cloudflare account identifier.

account_name

string

Cloudflare account name.

api_token

string

Cloudflare API token.

location_hint

string

Bucket location hint.

Choices:

  • "apac"

  • "eeur"

  • "enam"

  • "weur"

  • "wnam"

  • "oc"

name

string / required

Bucket name.

state

string

Bucket state.

Choices:

  • "absent"

  • "present"

storage_class

string

Default storage class.

Choices:

  • "Standard"

  • "InfrequentAccess"

cloudflare_r2_buckets_account_api_key

string

Cloudflare account API key.

cloudflare_r2_buckets_account_email

string

Cloudflare account email.

cloudflare_r2_buckets_account_id

string

Cloudflare account identifier.

cloudflare_r2_buckets_account_name

string

Cloudflare account name.

cloudflare_r2_buckets_api_token

string

Cloudflare API token.

cloudflare_r2_buckets_default_location_hint

string

Default bucket location hint.

Choices:

  • "apac"

  • "eeur"

  • "enam"

  • "weur"

  • "wnam"

  • "oc"

cloudflare_r2_buckets_default_state

string

Default bucket state.

Choices:

  • "absent"

  • "present"

cloudflare_r2_buckets_default_storage_class

string

Default storage class.

Choices:

  • "Standard"

  • "InfrequentAccess"

Examples

- name: Ensure cloudflare R2 buckets
  hosts: all
  tasks:
    - name: Ensure cloudflare R2 buckets
      ansible.builtin.import_role:
        name: damex.cloudflare.cloudflare_r2_buckets
      vars:
        cloudflare_r2_buckets_account_id: 023e105f4ecef8ad9ca31a8372d0c353
        cloudflare_r2_buckets_api_token: "{{ cloudflare_api_token }}"
        cloudflare_r2_buckets:
          - name: backups
            location_hint: weur
          - name: media
            storage_class: InfrequentAccess
          - name: old-bucket
            state: absent