damex.cloudflare.cloudflare_pages_project module – Ensure Cloudflare Pages project

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

Synopsis

Parameters

Parameter

Comments

account_api_key

string

Cloudflare account API key.

Required together with account_email if api_token is not provided.

account_email

string

Cloudflare account email.

Required together with account_api_key if api_token is not provided.

account_id

string

Cloudflare account identifier.

Required if account_name is not provided.

account_name

string

Cloudflare account name.

Required if account_id is not provided.

Resolved to account identifier via the Cloudflare API.

api_token

string

Cloudflare API token.

Required if account_email and account_api_key are not provided.

Can be specified in CLOUDFLARE_TOKEN environment variable.

build_command

string

Build command.

destination_directory

string

Build output directory.

domains

list / elements=string

Custom domains to assign to the project.

name

string / required

Pages project name.

production_branch

string

Production branch name.

Required when state is present.

root_directory

string

Project root directory.

state

string

Project state.

Choices:

  • "absent"

  • "present" ← (default)

Attributes

Attribute

Support

Description

check_mode

Support: full

Supports check mode.

diff_mode

Support: full

Supports diff mode.

Examples

- name: Ensure Pages project
  damex.cloudflare.cloudflare_pages_project:
    name: my-docs
    account_name: damex
    api_token: "{{ cloudflare_api_token }}"
    production_branch: production
    build_command: make html
    destination_directory: build/html
    domains:
      - docs.example.com

- name: Ensure Pages project is absent
  damex.cloudflare.cloudflare_pages_project:
    name: old-project
    account_name: damex
    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

project

dictionary

Pages project object from the Cloudflare API.

Returned: when state is present

domains

list / elements=string

Custom domains.

Returned: success

name

string

Project name.

Returned: success

production_branch

string

Production branch.

Returned: success

subdomain

string

Pages subdomain.

Returned: success

Authors

  • Roman Kuzmitskii (@damex)