This repository will contain sample code to deploy the sample application on linux instance
-
configs - contain environment specific variable
-
inventories - contains inventory file for each environment
-
groups_vars - contains common variables across environments
-
roles - This will have subfolders like java,tomcat
a) tomcat - this folder will have files related to the installation of tomcat
- files (This will contain files which you want to copy to to your destination servers) - handlers ( This is used to start/stop the services) - templates (This will contain template files) - tasks ( playbook to install the software)
b) add_devops_user - This folder will have files related to the setup of initial user
-
main.yml - This is the main file which will execute roles in the playbook
ansible-playbook main.yml -i inventories/dev/hosts --user ec2-user --key-file /home/ec2-user/playbooks/ansible_aut.pem -e '@configs/dev.yml'
ansible-playbook main.yml -i inventories/dev/hosts --user devops --key-file /home/devops/.ssh/id_rsa -e '@configs/dev.yml'