YAML is a human-readable format for configuration. Its short, indented entries make settings easy to review at a glance. A YAML file can describe what an automation tool should do without spelling out every step the tool takes. section 4.1.1
Listing 4.1 YAML basics
name: Hello World
items:
sub-item:
name: Hello
description: world
sub-list:
- element a
- element b
other-list: [1, 2, 3]
Start with `name: Hello World`. Indentation places `sub-item` under `items`; hyphens and square brackets show two ways to write lists. section 4.1.1
To automate a Python project with GitHub Actions, put a workflow in `.github/workflows/hello-world.yaml`. The YAML declares when to run, which job and operating system to use, and which steps to execute. Commit and push the file so GitHub Actions can recognize it. section 4.1.1
Listing 4.2 Hello World with GitHub Actions
name: Hello World
on:
workflow_dispatch:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Hello World
run: echo "Hello World"
This workflow runs on a push or a manual request. Its `build` job checks out the repository, then runs a command that prints “Hello World.” section 4.1.1
The same format serves other deployment tasks. Ansible playbooks use YAML to define the desired state of remote hosts. Once a container image and Kubernetes cluster are available, a YAML file called a manifest describes an application deployment. YAML is useful across these tools and across application languages such as Python and Node.js. section 4.2.1 section 8.0 section 4.3















