You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ansible server first setup after Ansible installation. This guide will detail connecting to a remote server on ubuntu virtual machines and connecting. It will also detail how to run a playbook. The steps will ultimately show how to setup dynamic inventory and run a playbook on a remote server(AWS) using ansible. First, we need to install ansible on the server.
sudo apt update
sudo apt install ansible
Next, we need to create a user on the remote server.
Next, we will look at steps to setup dynamic inventory for AWS.
pip install boto
pip install boto3
pip install botocore
Next, we will create a file called aws_ec2.yml in the project directory.
nano aws_ec2.yml
Add the following to the aws_ec2.yml file.
---
plugin: aws_ec2
regions:
- us-east-1
keyed_groups:
- key: tags
prefix: tag
```### Next, we will run the following command to create the dynamic inventory.```bash
ansible-inventory -i aws_ec2.yml --graph
Next, we will run the playbook using the dynamic inventory.
ansible-playbook -i aws_ec2.yml playbook.yml
This guide has shown how to setup an ansible server, connect to a remote server, and run a playbook. It has also shown how to setup dynamic inventory and run a playbook on a remote server(AWS) using ansible.