Skip to content

This repo contains an Ansible exercise, provisions with Terraform and AWS as provider.

Notifications You must be signed in to change notification settings

MathoAvito/Ansible-Exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible and Terraform Exercise

This repository contains an exercise which leverages Ansible and Terraform to provision infrastructure on AWS and deploy a simple webpage on EC2 instances.

Table of Contents

  1. Getting Started
  2. Instructions
  3. Project Structure
  4. Files and Configuration Details
  5. Credits
  6. Acknowledgements
  7. See Also

Getting Started

  • Clone this repository to your local machine.

    git clone https://github.com/MathoAvito/Ansible-Exercise.git
  • Ensure you have Ansible, Terraform, and AWS CLI installed.

    sudo apt-get update && sudo apt-get install ansible terraform awscli -y

If not installed, you need to install them according to your OS specifications. Make sure you also have AWS CLI configured with your credentials.

Instructions

Check out the instructions for this exercise.

Project Structure

The project has the following structure:

/
├── Ansible/
│   ├── ansible.cfg
│   ├── playbook.yml
│   └── Webfile/
│       └── index.html
└── Terraform/
    ├── main.tf
    ├── variables.tf
    ├── modules/
    │   ├── compute/
    │   │   ├── main.tf
    │   │   ├── variables.tf
    │   │   └── outputs.tf
    │   └── network/
    │       ├── main.tf
    │       ├── variables.tf
    │       └── outputs.tf
    └── entrypoint.sh

Files and Configuration Details

The files within this project are set up as follows:

Terraform

The Terraform files within the Terraform/ directory and its subdirectories are used to provision and configure AWS resources:

  • main.tf: This is the main Terraform configuration file which references the network and compute modules.
  • variables.tf: This file holds the declarations for variables used within the Terraform configuration files.
  • modules/network: This module is used to provision network-related resources, such as a VPC, subnets, an internet gateway, and a security group.
  • modules/compute: This module is used to provision compute-related resources, namely AWS EC2 instances.
  • entrypoint.sh: This script installs the necessary dependencies for Ansible and sets up the Ansible control node.

Ansible

The Ansible files within the Ansible/ directory are used to configure the EC2 instances:

  • ansible.cfg: This is the main Ansible configuration file which sets Ansible defaults and other configurations.
  • playbook.yml: This Ansible playbook is used to deploy a simple webpage to the EC2 instances.

See Also

Credits

This project is maintained by MathoAvito.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

This repo contains an Ansible exercise, provisions with Terraform and AWS as provider.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published