GithubHelp home page GithubHelp logo

ansible-roles's Introduction

Ansible-Roles

demo application

4640 "app" components

Included material

backend:

backend binary, hello-server service file for backend, hello-server.service

service file includes info about where the binary should be on your server

caddy file(this just exposes the backend on port 80), Caddyfile

frontend:

frontend, index.html nginx configuration file, hello.conf

The nginx configuration file needs to be edited

about the backend 'hello-server' exposes localhost:8080/echo This just echos back a post request message. An example curl command has been included for testing the backend. If everything is setup you will see your message echoed back to you.

Where should these files go

backend(hello-server) and frontend(index.html):

the files above provide the file paths (see service and nginx config)

Caddyfile /etc/caddy

hello-server.service /etc/systemd/system

Example curl commands for testing your server Replace the IP address in the examples with the IP address of your servers Run these commands from your host machine, not your server.

Testing your frontend

curl http://146.190.12.184

Testing your backend

curl -X POST -H "Content-Type: application/json"
-d '{"message": "Hello from your server"}'
http://146.190.12.184/echo

the link to the demo video : https://youtu.be/PcIiqDKu2Qw Sorry I missed the part for the ansible - so i recorded a very short video with the link: https://youtu.be/B6sd5_4ppdE

after downloading the zip file, Haniehsadat_gholamhosseini_as2.zip:

  • in the main.tf inside the zip folder - comment the bucket configurations inside the terraform block on the top main.tf

as3 directory acts as terraform directory and as3-files-4640-w24 acts as my ansible directory

  • run 'terraform init' to Prepare your working directory for other commands - so the backend.tf creates the s3 bucket and the dynamodb table to be prepred for the block that we just commented
  • uncomment the bucket configuration inside the main.tf file in order to use AWS S3 for storing Terraform state files.
  • run "terraform init" in your terminal or command prompt to initialize Terraform
  • it asks for a permission - if its ok to move the tv state from writing it , type yes
  • run 'terraform apply' to Create infrastructure (this will take a few minutes)

Once completed, clone the appliaction repository (https://gitlab.com/cit_4640/as3-files-4640-w24) I treated "as3-files-4640-w24" directory as my ansible - where my hosts.yml and ansible.config will be created in When Apply complete, will output ec2 instances public ip You should have hosts.yaml and ansible.config generated by terraform in the as3-files-4640-w24 directory located in same directory as main.tf.

  • run cd '4640-assignment-app-files' where the application files and playbook are
  • run 'ansible-playbook playbook.yml' to Run Ansible Playbook against the Infrastructure you just created

Once completed, do testing as instrcuction says in the README.md in the git repository as cloned in the same directory as main.tf in as3 directory

ansible-roles's People

Contributors

haniehsadgh avatar

Watchers

 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.