A very simple Ansible playbook example to illustrate various concepts.
This playbook simply installs nginx in an EC2 that we assume is running an Amazon Linux 2 AMI
Because there is a local.yml
file in this repository, you can pull this repository and make it run automatically with this command:
ansible-pull -U URL_OF_THE_PLAYBOOK
You can also push the configuration remotely by running this command:
ansible-playbook -i aws_ec2.yml site.yml
The inventory is using the aws_ec2
Ansible plugin. You need to have one or more instance with the Name tag as webserver-demo
.
You can have a look at your hosts with this command: ansible-inventory -i aws_ec2.yml --graph
.
Click here for more info.