community.general.rax_files (6.6.8) — module

Manipulate Rackspace Cloud Files Containers

Authors: Paul Durivage (@angstwad)

Install collection

Install with ansible-galaxy collection install community.general:==6.6.8


Add to requirements.yml

  collections:
    - name: community.general
      version: 6.6.8

Description

Manipulate Rackspace Cloud Files Containers.

This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.

Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.


Requirements

Usage examples

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

    - name: "Create container called 'mycontainer'"
      community.general.rax_files:
        container: mycontainer

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

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

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

    - name: "Make container public"
      community.general.rax_files:
        container: mycontainer
        public: true

    - name: "Make container public with a 24 hour TTL"
      community.general.rax_files:
        container: mycontainer
        public: true
        ttl: 86400

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

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

    - name: "Remove mycontainer2 metadata"
      community.general.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
    type: int

meta:
    default: {}
    description:
    - A hash of items to set as metadata values on a container
    type: dict

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

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

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

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

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

private:
    default: false
    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.
    type: str

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
    type: str

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

clear_meta:
    default: false
    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