/ansible-practice

Playbook examples to demonstrate basic concepts when writing Ansible playbooks.

Primary LanguageHTML

How To Write Ansible Playbooks

This repository contains the examples and demos from the How To Write Ansible Playbooks Tutorial Series.

Please notice that the playbooks in this repository are for demonstration and learning. They are not intended for production setups.

Usage

To try these examples on your local Ansible setup, start by cloning this repository on your Ansible Control Node.

git clone https://github.com/do-community/ansible-practice.git
cd ansible-practice

Edit the included inventory file to include your remote node(s):

nano inventory
[dev]
203.0.113.10

[all:vars]
ansible_python_interpreter=/usr/bin/python3

Save and close the file.

You can run the playbooks with:

ansible-playbook -i inventory playbook-01.yml -u REMOTE_USER

If the playbook has a become directive it means you'll most probably will have to provide the sudo password for your connecting user. You dan do that by including the -K parameter:

ansible-playbook -i inventory playbook-01.yml -u REMOTE_USER -K

For more details, please refer to the tutorial series: How To Write Ansible Playbooks.