{"id":24849365,"url":"https://github.com/bugbiteme/demo-tform-ansible-aws","last_synced_at":"2025-10-28T18:03:36.853Z","repository":{"id":71384423,"uuid":"336959105","full_name":"bugbiteme/demo-tform-ansible-aws","owner":"bugbiteme","description":"A simple lab to demonstrate deploying and configuring a load balancer and two web servers in AWS","archived":false,"fork":false,"pushed_at":"2021-04-05T19:24:10.000Z","size":270,"stargazers_count":3,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T17:07:29.942Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bugbiteme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-08T04:24:02.000Z","updated_at":"2021-05-15T02:40:53.000Z","dependencies_parsed_at":"2023-04-11T17:17:32.840Z","dependency_job_id":null,"html_url":"https://github.com/bugbiteme/demo-tform-ansible-aws","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-ansible-aws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-ansible-aws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-ansible-aws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugbiteme%2Fdemo-tform-ansible-aws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugbiteme","download_url":"https://codeload.github.com/bugbiteme/demo-tform-ansible-aws/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248602315,"owners_count":21131616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-31T12:30:58.522Z","updated_at":"2025-10-28T18:03:31.805Z","avatar_url":"https://github.com/bugbiteme.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Create and deploy an Apache LB and two Apache web hosts\n\n- Uses Terraform to deploy three identical EC2 instances\n- Terraform will dynamically generate an Ansible inventory file 'host-dev'\n- It will also dynamically create an SSH keypair and place the private key in this directory.\n\n![Diagram](img/demo-tform-ansible-aws.png)\n\nOnce all three instances have been deployed, run the Ansible playbook\n`playbooks/all-playbooks.yml`\n\ncommand: `ansible-playbook playbooks/all-playbooks.yml`\n\nAnsible will update and install Apache on all server and configure the first host to be\na loadbalancer. Ansible will then deploy a PHP website to the other two servers that is accessed through the loadbalancer.\n\nOnce complete, you can connect to the IP address of the LB to view the main webpage\n\nTo test out loadbalancer, add /info.pho to the end of the LB IP address, and refresh to see\nloadbalancing in action... exiting!!!\n\n`http://\u003clb IP address\u003e/info.php`\n\n## Instructions for included scripts\n### Prereqs:\n\n- Ansible and Terraform are installed on your local system\n\nOn a Mac:\n\n`brew install terraform ansible`\n\n- The AWS CLI has been installed and configured with your access key and key ID on the local system\n\n### Provision VMs and configure loadbalancer and web servers\nNote: Output will provide a link to access the website and test load balancer\n\n`sh provision_and_config.sh`\n\n## Clean up VMs when you are done\nNote: This will delete all of the VMs, but will prompt you before doing so.\n\n`sh cleanup.sh`\n\n## Other random stuff\n\n### Some adhoc commands:\n\n```\nansible -m ping all\nansible -m shell -a \"uname\" webservers:loadbalancers\nansible -m shell -a \"uname\" all \n\n```\n\n### Module Index:\nhttps://docs.ansible.com/ansible/2.9/modules/modules_by_category.html\n\n### playbooks commands:\n\n```\nansible-playbook playbooks/ping.yml\nansible-playbook playbooks/uname.yml\nansible-playbook playbooks/yum-update.yml\nansible-playbook playbooks/yum-update.yml \nansible-playbook playbooks/setup-lb.yml\n\n```\n\n\n`ansible -m setup app1`  (get variable info on a system)\n\n```\nansible -m setup app1 | grep ansible_hostname\n        \"ansible_hostname\": \"ip-172-31-1-131\",\n\nansible -m setup webservers | grep ansible_hostname\n        \"ansible_hostname\": \"ip-172-31-1-131\",\n        \"ansible_hostname\": \"ip-172-31-3-65\",\n\n```\n\n### check mode\n\n`ansible-playbook playbooks/setup-app.yml --check`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugbiteme%2Fdemo-tform-ansible-aws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugbiteme%2Fdemo-tform-ansible-aws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugbiteme%2Fdemo-tform-ansible-aws/lists"}