ansible.builtin.rax_files (v2.9.27) — module

Manipulate Rackspace Cloud Files Containers

| "added in version" 1.5 of ansible.builtin"

Authors: Paul Durivage (@angstwad)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Manipulate Rackspace Cloud Files Containers


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Test Cloud Files Containers"
  hosts: local
  gather_facts: no
  tasks:
    - name: "List all containers"
      rax_files:
        state: list

    - name: "Create container called 'mycontainer'"
      rax_files:
        container: mycontainer

    - name: "Create container 'mycontainer2' with metadata"
      rax_files:
        container: mycontainer2
        meta:
          key: value
          file_for: someuser@example.com

    - name: "Set a container's web index page"
      rax_files:
        container: mycontainer
        web_index: index.html

    - name: "Set a container's web error page"
      rax_files:
        container: mycontainer
        web_error: error.html

    - name: "Make container public"
      rax_files:
        container: mycontainer
        public: yes

    - name: "Make container public with a 24 hour TTL"
      rax_files:
        container: mycontainer
        public: yes
        ttl: 86400

    - name: "Make container private"
      rax_files:
        container: mycontainer
        private: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Test Cloud Files Containers Metadata Storage"
  hosts: local
  gather_facts: no
  tasks:
    - name: "Get mycontainer2 metadata"
      rax_files:
        container: mycontainer2
        type: meta

    - name: "Set mycontainer2 metadata"
      rax_files:
        container: mycontainer2
        type: meta
        meta:
          uploaded_by: someuser@example.com

    - name: "Remove mycontainer2 metadata"
      rax_files:
        container: "mycontainer2"
        type: meta
        state: absent
        meta:
          key: ""
          file_for: ""

Inputs

    
env:
    description:
    - Environment as configured in I(~/.pyrax.cfg), see U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration).
    type: str

ttl:
    description:
    - In seconds, set a container-wide TTL for all objects cached on CDN edge nodes. Setting
      a TTL is only appropriate for containers that are public

meta:
    description:
    - A hash of items to set as metadata values on a container

type:
    choices:
    - file
    - meta
    default: file
    description:
    - Type of object to do work on, i.e. metadata object or a container object

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Indicate desired state of the resource

public:
    description:
    - Used to set a container as public, available via the Cloud Files CDN
    type: bool

region:
    default: DFW
    description:
    - Region to create an instance in
    type: str

api_key:
    aliases:
    - password
    description:
    - Rackspace API key, overrides I(credentials).
    type: str

private:
    description:
    - Used to set a container as private, removing it from the CDN.  B(Warning!) Private
      containers, if previously made public, can have live objects available until the
      TTL on cached objects expires
    type: bool

username:
    description:
    - Rackspace username, overrides I(credentials).
    type: str

container:
    description:
    - The container to use for container or metadata operations.
    required: true

tenant_id:
    description:
    - The tenant ID used for authentication.
    type: str

web_error:
    description:
    - Sets an object to be presented as the HTTP error page when accessed by the CDN URL

web_index:
    description:
    - Sets an object to be presented as the HTTP index page when accessed by the CDN URL

clear_meta:
    default: 'no'
    description:
    - Optionally clear existing metadata when applying metadata to existing containers.
      Selecting this option is only appropriate when setting type=meta
    type: bool

credentials:
    aliases:
    - creds_file
    description:
    - File to find the Rackspace credentials in. Ignored if I(api_key) and I(username)
      are provided.
    type: path

tenant_name:
    description:
    - The tenant name used for authentication.
    type: str

auth_endpoint:
    description:
    - The URI of the authentication service.
    - If not specified will be set to U(https://identity.api.rackspacecloud.com/v2.0/)
    type: str

identity_type:
    default: rackspace
    description:
    - Authentication mechanism to use, such as rackspace or keystone.
    type: str

validate_certs:
    aliases:
    - verify_ssl
    description:
    - Whether or not to require SSL validation of API endpoints.
    type: bool