cdelgehier.sfs.sfs (1.1.0) — module

Upload, download, and delete files in Secure File Service.

| "added in version" 2.9 of cdelgehier.sfs"

Authors: Cédric DELGEHIER (@cdelgehier)

preview | supported by community

Install collection

Install with ansible-galaxy collection install cdelgehier.sfs:==1.1.0


Add to requirements.yml

  collections:
    - name: cdelgehier.sfs
      version: 1.1.0

Description

Upload, download, and delete files in Secure File Service.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Test sfs"
  hosts: localhost
  gather_facts: false
  vars:
    org: "{{ lookup('env', 'ORG') }}"
    context: "{{ lookup('env', 'CONTEXT') }}"
    remote_file_name: "{{ lookup('env', 'RFILE') }}"

  tasks:
    - name: "List contexts"
      sfs:
        method: list_contexts
        org: "{{ org }}"

    - name: "Delete a file from a context"
      sfs:
        method: delete
        org: "{{ org }}"
        context: "{{ context }}"
        remote_file_name: test.zip

    - name: "List files in a context"
      sfs:
        method: list_files
        org: "{{ org }}"
        context: "{{ context }}"

    - name: "Get a file in a context"
      sfs:
        method: get
        org: "{{ org }}"
        context: "{{ context }}"
        remote_file_name: "{{ remote_file_name }}"
        local_file_path: /tmp

    - name: "Push file to a context"
      sfs:
        org: "{{ org }}"
        context: "{{ context }}"
        local_file_path: /path/to/folder
        # remote_file_name:

    - name: "Return the latest file in a context"
      sfs:
        method: file_most_recent
        org: "{{ org }}"
        context: "{{ context }}"

Inputs

    
org:
    description:
    - The organization is the namespace of the contexts.
    required: true
    type: str

url:
    description:
    - This is the url of the storage service (note this is not necessarily the same as
      that of the UI)
    - If it is not defined, the module will look for it in the variable "SFS_UPLOAD_URL"
    required: false
    type: str

user:
    description:
    - This is the user used to perform the actions.
    - If it is not defined, the module will look for it in the variable "TOWER_USERNAME"
    type: str

context:
    description:
    - The context is the folder where the files are stored.
    - This is often the name of the awx project.
    required: false
    type: str

password:
    description:
    - This is the password used to perform the actions.
    - If it is not defined, the module will look for it in the variable "TOWER_PASSWORD"
    type: str

cert_verify:
    aliases:
    - verify
    default: false
    description:
    - Enable TLS verification
    type: bool

local_file_path:
    default: $PWD/sfs
    description:
    - Local directory used.
    - With the "put" method, this folder is zipped before the push to SFS.
    - With the "get" method, this folder is used to store the file downloaded.
    type: str

remote_file_name:
    description:
    - it is the name of the file in the context.
    - With the "put" method, this file will be stored in /{{org}}/{{context}}/
    - If the name is not defined, the file will be pushed with this default value "{{org}}_{{context}}_{{date_epoch}}.zip"
    type: str