Giter Club home page Giter Club logo

ansible-aws's Introduction

Using Ansible with AWS

This repo contains the code to go along with my YouTube video Using Ansible with AWS.

Create a virtual environment

I strongly recommend using a virtual environment for all things ansible. There are few things worse than troubleshooting ansible for a few days only to learn that it was some unrelated package causing the problem (when your highschool sweetheart dumps you being on that list). Using a virtual environment ensures you control dependencies plus makes this whole thing portable.

python3 -m venv .env
source .env/bin/activate

Install dependencies

Install the python dependencies needed, including ansible.

pip install -r requirements.txt

Configure dynamic inventory

We'll use the ansible inventory role for communicating with AWS.

ansible-galaxy collection install amazon.aws

This requires an inventory file. Modify aws_ec2.yaml to match your environment as needed.

Check it out

For this to work, you need an AWS Access Key and AWS Secret Access Key. The also must be configured to work with your system. See this for additional info.

Now we can get an inventory of our AWS environment:

ansible-inventory -i aws_ec2.yaml --graph

Targeting hosts

You can also target specific hosts based on tag names:

aws tag_Role_webserver -i aws_ec2.yaml -m ping

will connect to all EC2 instances with a tag named Role that has a value of webserver

Using playbooks

You can now configure EC2 instances using ansible playbooks that you create, or downloaded from Ansible Galaxy.

For additional details, check out the accompanying video on the DevOps for Developers YouTube channel.

ansible-aws's People

Contributors

rekibnikufesin 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.