Config Files · 1 file

Sample Ansible File

Ansible playbooks are YAML files that configure servers with tasks and handlers. Our sample is realistic and valid for its tool, with fake hosts and secrets.

Ansible · 847 B

Ansible playbook

An Ansible playbook that installs and configures nginx with variables, a template, a handler and a service task. All hosts, keys and secrets are fake.

CC0 · free for any use · Verified by an independent tool · Report a problem

playbook.yml — first linesYAML
# Sample Ansible playbook — samplefiles.com
- name: Configure web servers
  hosts: web
  become: true
  vars:
    nginx_port: 80
    site_root: /var/www/example

  tasks:
    - name: Install nginx
      ansible.builtin.apt:
        name: nginx
        state: present
        update_cache: true

    - name: Create site root
      ansible.builtin.file:
        path: "{{ site_root }}"
        state: directory
        mode: "0755"

    - name: Deploy site config
      ansible.builtin.template:
        src: templates/site.conf.j2
        dest: /etc/nginx/conf.d/site.conf

File details

Size
847 B (847 bytes)
MIME type
application/yaml
SHA-256
93ecb48eeabc2b383b8325a58d86d7b32d951e6d9910d8ab451208b5a3c9cfee
MD5
3c1654db18c8ec3a6fb520f052aaeea7

Download from the command line

curl -L -o playbook.yml https://files.samplefiles.com/config/ansible/playbook.yml

Or check the download in your browser with the checksum calculator.