PPA Tools PPA Tools: Files

Summary

This module contains actions used to read & write files in the task workspace.

The task workspace contains any supporting playbook files, & any files created by other plugins.

PPA Version

The actions in this module require PPA v2.7.x or newer.

Actions

ppa_tools.files.

read_json_file

Read a JSON file from the task workspace.

Minimum Plugin Version: 4.0.0

Minimum PPA Version: 2.7.0

Input
  • name: the name of the file including the extension
Output

A loaded JSON object.

Example
- ppa_tools.files.read_json_file:
    name: config.json
  save: config

ppa_tools.files.

read_text_file

Read a text file from the task workspace.

Minimum Plugin Version: 4.0.0

Minimum PPA Version: 2.7.0

Input
  • name: the name of the file including the extension
Output

The file contents as a string.

Example
- ppa_tools.files.read_text_file:
    name: intro.md
  save: introduction

- ppa.ui.output_markdown:
    doc: ""

ppa_tools.files.

write_json_file

Write a JSON file to the task workspace.

This action will fail if the supplied items cannot be converted to JSON.

Minimum Plugin Version: 4.0.0

Minimum PPA Version: 2.7.0

Input
  • name: the name of the file including the extension

  • contents: any JSON serializable value

Output

Nothing is outputted by this action.

Example
- set:
    name: example_json
    value:
      key_1: value_1
      key_2: value_2

- ppa_tools.files.write_json_file:
    name: example.json
  load:
    contents: example_json

ppa_tools.files.

write_text_file

Write a text file to the task workspace.

Minimum Plugin Version: 4.0.0

Minimum PPA Version: 2.7.0

Input
  • name: the name of the file including the extension

  • contents: the file contents to write

Output

Nothing is outputted by this action.

Example
- ppa.ui.input_text:
    text: Supply some text
  save: text

- ppa_tools.files.write_text_file:
    name: example.txt
  load:
    contents: text