Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tijani891/altschool-iac-project
https://github.com/tijani891/altschool-iac-project
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tijani891/altschool-iac-project
- Owner: Tijani891
- Created: 2023-02-05T08:34:20.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-18T21:22:31.000Z (almost 2 years ago)
- Last Synced: 2023-12-31T10:33:15.810Z (about 1 year ago)
- Language: HCL
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deploying Apache web server using Terraform and Ansible
This repository contains code for deploying an Apache web server on an AWS EC2 instance using Terraform and Ansible. This document provides instructions for setting up and deploying the infrastructure and application.
## Prerequisites
Before getting started, make sure you have the following tools installed:- Terraform
- Ansible
- AWS CLIAdditionally, make sure that you have an AWS account set up and have access and secret keys with the necessary permissions.
## Getting started
1. Clone the repository to your local machine.
2. Navigate to the terraform directory and create a variable.tf file containing the following variable:
variable "aws_region" {
default = "<"AWS-REGION">"
description = "Sets aws region"
}
3. Initialize the Terraform working directory by running the following command:
terraform init
4. Review the main.tf file to make sure it is configured correctly for your needs.
5. Create the infrastructure by running the following command:
terraform apply6. Once the infrastructure is created, navigate to the ansible directory and create an ansible.cfg file with the following contents:
[defaults]
inventory =
remote_user = < hostname>
private_key_file =
7. Update the `hosts` file to include the IP address of the EC2 instance created in step 5.
8. Run the Ansible playbook to deploy the Apache web server by running the following command:
ansible-playbook .yml## Accessing the application
Once the deployment is complete, you should be able to access the Apache web server by entering the IP address of the EC2 instance into a web browser.