thoteam.var_as_file.var_as_file (1.0.1) — lookup

Get a file path containing a variable/content

Authors: Olivier Clavel (@zeitounator)

Install collection

Install with ansible-galaxy collection install thoteam.var_as_file:==1.0.1


Add to requirements.yml

  collections:
    - name: thoteam.var_as_file
      version: 1.0.1

Description

Creates a temporary file with the content passed as argument and returns its path on the controller.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get a filename with the given content for later use
  ansible.builtin.set_fact:
    my_tmp_file: "{{ lookup('thoteam.var_as_file.var_as_file', some_variable) }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Use in place in a module where a file is mandatory and you have the content in a var
  community.general.java_cert:
    pkcs12_path: "{{ lookup('thoteam.var_as_file.var_as_file', pkcs12_store_from_vault) }}"
    cert_alias: default
    keystore_path: /path/to/my/keystore.jks
    keystore_pass: changeit
    keystore_create: yes
    state: present

Inputs

    
_content:
    description: the content that should be included in the file.
    required: true

Outputs

_raw:
  description:
  - path to the temporary file with the content.
  type: str