edit_yaml

Operation to edit yaml by merging data into existing yaml data.

Example

The following example adds the redis service to a docker-compose.yml file:

examples/operations/edit_yaml.yml
steps:
    "Add redis to docker-compose file":
        name: edit_yaml
        file_path: "examples/data/docker-compose.yml"
        merge_data:
            services:
                redis:
                    image: "redis:alpine"

Note that merge_data can specify arbitrarily nested data. This data will be merged with existing data, so other services defined in the file will be preserved.

Required context

file_path

Path to file relative to the current working directory.

merge_data

Data that will be merged into existing data in yaml file.

See also