Git Product home page Git Product logo

ansibles's Introduction

ansibles

Ansible boilerplate and tricks

This repository demonstrates the working mechanism of Ansible. It contains two Dockerfiles: control.Dockerfile to build the Ansible control container (with Python3, ssh-client and Ansible installed) and node.Dockerfile to build the node containers (with an 'ansible' sudo user, ssh-server and Python3 installed). It has a docker-compose.yml file which builds 3 services: the Ansible control and two nodes. After a successful docker-compose up you may exec into the control container and execute an Ansible playbook locally, which prepares the container for accessing the nodes via ssh. Then you can run two different playbooks against the nodes: one that just prints out their inventory-name (proving that Ansible can reach these hosts), and another which deploys a simple http web service on them.

Usage

Build and run the ansible-control and the two ansible-node containers
docker-compose up --build

Exec into the ansible-control container
docker exec -it <container_id> bash

Prepare the ansible-control container with
ansible-playbook prepare-control.yml

Run test playbook on ansible-nodes
ansible-playbook -i inventory.yml remote-test.yml

Run webserver playbook on ansible-nodes
ansible-playbook -i inventory.yml remote-playbook.yml

After successfully running all the three playbooks ansible-node-1 should be accessible at http://localhost:7070 and ansible-node-2 at http://localhost:9090

ansibles's People

Contributors

donbattery avatar

Watchers

James Cloos 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.