DevTools Logo

Ansible Playbook Generator

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML.

Play

Task 1

Task 2

playbook.yml

---
- name: Install and start nginx
  hosts: webservers
  become: true
  vars:
    app_port: 80
  tasks:
    - name: Install nginx
      apt:
        name: nginx
        state: present
    - name: Start nginx
      service:
        name: nginx
        state: started
        enabled: true
client-side
YAML

Examples

Install and start nginx

Input
hosts webservers, become yes
task Install nginx (apt): name: nginx / state: present
task Start nginx (service): name: nginx / state: started
Output
- name: Install and start nginx
  hosts: webservers
  become: true
  tasks:
    - name: Install nginx
      apt:
        name: nginx
        state: present

A play with sudo and two tasks using the apt and service modules.

About this tool

The Ansible Playbook Generator writes a playbook YAML from a form. Set the play name and hosts, toggle become for sudo, declare vars as KEY=VALUE lines, and add tasks — each with a name, a module, and YAML-style arguments. The output is a ready-to-run playbook — nothing is uploaded.

How to use

  1. Set hosts and vars

    Pick the host group and add variables; numeric and boolean values are left bare, strings are quoted.

  2. Add tasks

    Each task has a module (apt, service, copy, …) and indented YAML arguments.

  3. Run the playbook

    Save the YAML and run it with `ansible-playbook`.

Use cases

Server provisioning

Define the steps to configure a fresh server.

Common mistakes

Mistake:Indentation in arguments.

Fix:Keep argument lines aligned; YAML is indentation-sensitive and misaligned args fail to parse.

Frequently asked questions

References & standards