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
# 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.confFile details
Download from the command line
curl -L -o playbook.yml https://files.samplefiles.com/config/ansible/playbook.ymlwget https://files.samplefiles.com/config/ansible/playbook.ymlhttps://files.samplefiles.com/config/ansible/playbook.ymlprintf '%s %s\n' 93ecb48eeabc2b383b8325a58d86d7b32d951e6d9910d8ab451208b5a3c9cfee playbook.yml | shasum -a 256 -cOr check the download in your browser with the checksum calculator.