Code Monkey home page Code Monkey logo

ansible_deploy_aws's Introduction

Deploy AWS Stack with Ansible

size-vs-layers tag-version

This project will deploy the entire stack on AWS and it will store the state for this stack.

It's possible to create/update/delete without changing the logic, just changing the variables on group_vars/all/.


Index


Pre-requirements

  • Developed, Tested and Executed on Ansible 2.7.6
  • Define the variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

Running

You have multiple choices to use in here. You can just deploy or just delete, deploy and after delete everything or just a few resources.

Deploying & Deleting

To deploy your stack and after deleting everything, you can run this command.

ansible-playbook -e "delete_env=true" playbook

If you use -e "delete_env=false" for this variable or don't set up, it will just deploy the stack and create the state files/variables.

Just Deleting

To delete without creating anything, you can run this command.

ansible-playbook -e "just_delete=true" playbook

How it works

If you need to deploy the entire stack, you can just execute the ansible like ansible-plabook playbook.yml. But you can add, change or delete resources easily.

SSH Key

The role 01-ssh_key will check if not exist the files on files/keys/ and will create, otherwise, it will skip the ssh key generation.

Based on these files (Private/Public), the role will deploy the public key on your AWS Account

Security Group

These tasks are dynamic generated/updated. You just need to change the files group_vars/all/sg_roles.yml or roles/02-security_groups/templates/create_sg.j2 (Optional).

By default, it will allow your public IPv4 to access via SSH/TCP on 22 port and ports 80/443-TCP to download packages from yum repositories.

EC2

At the end of the role 03-ec2, it will create the hosts ansible inventory file and print the public and private IPv4 of your instances.

Example:

TASK [03-ec2 : Creating inventory file] *****************************************************************************************************************************************************************
changed: [localhost]

TASK [03-ec2 : Instances Private ipv4] ******************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": [
        "x.x.x.x",
        "x.x.x.x",
        "x.x.x.x"
    ]
}

TASK [03-ec2 : Instances Public ipv4] *******************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": [
        "y.y.y.y",
        "y.y.y.y",
        "y.y.y.y"
    ]
}

ansible_deploy_aws's People

Contributors

lozanomatheus avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.