Giter Site home page Giter Site logo

neroblack4life / ansible-labs-101 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mikecali/ansible-labs-101

0.0 1.0 0.0 26 KB

The purpose of this repo is to help new ansible users to build a multi-host lab environment on thier local machine

License: GNU General Public License v3.0

Shell 100.00%

ansible-labs-101's Introduction

Ansible Environment:

Multi-Machine Vagrant Environments: This Vagrantfile will create 3 Centos VM's to simulate Ansible control machine and 2 target hosts.

  • Host1 - No GUI
  • Host2 - No GUI
  • ansible-host - No GUI, ansible core installed and Ansible-tower

Requirements:

  • Internet connection is a must!
  • Make sure the VT support is enabled on your BIOS
  • Vagrant - 1.9.x or higher
  • Vagrant plugins - vagrant-proxyconf - needed if you are running behind proxy
  • Ansible: latest
  • Virtualbox: latest

Note: if the build fail because of the hypervisor errors. You need to follow this steps.

First find out the name of the hypervisor:

$ lsmod | grep kvm
kvm_intel             204800  6
kvm                   593920  1 kvm_intel
irqbypass              16384  1 kvm

The one we're interested in is kvm_intel. You might have another.

Blacklist the hypervisor (run the following as root):

$ echo 'blacklist kvm-intel' >> /etc/modprobe.d/blacklist.conf

Restart your machine and try running vagrant again.

Other files included:

  • ansible.cfg
  • inventory
  • bootstrap-node.sh
  • ansible-install.yaml
  • playbook.yaml
  • inventory-test.yaml

Connecting the dots:

Before you run vagrant up, make sure that you updated the Vagrantfile to your desired configuration. Specifically use the box that are available from https://atlas.hashicorp.com/boxes/. The entry on the current vagrant file are Datacom specific boxes and is not available from atlas.

Once you are done:

  • vagrant up Wait for about 6 minutes to finish the build. Once done. You can try to ssh to your ansible-host vm. You can verify this by using "vagrant status"

  • vagrant ssh ansible-host once you are login to your ansible-host vm, you can now verify if the other vm are reachable. The command to use is: "ansible-playbook -i inventory playbook/ping.yml"

Ansible Testing

The Vagrantfile:

Vagrant.configure("2") do |config|
# Define VMs with static private IP addresses, vcpu, memory and vagrant-box.
  boxes = [
    {
      :name => "client2",
      :box => "bento/centos-7.2",
      :ram => 512,
      :vcpu => 1,
      :ip => "192.168.29.2"
    },
    {
      :name => "client1",
      :box => "bento/centos-7.2",
      :ram => 512,
      :vcpu => 1,
      :ip => "192.168.29.3"
    },
    {
      :name => "ansible-host",
      :box => "x.x.x.xxx",
      :ram => 1024,
      :vcpu => 1,
      :ip => "192.168.29.4"
    }
  ]


  # Provision each of the VMs.
  boxes.each do |opts|
    config.vm.define opts[:name] do |config|
#   Only Enable this if you are connecting to Proxy server
#      config.proxy.http     = "http://x.x.x.x:3128"
#      config.proxy.https    = "http://x.x.x.x:3128"
#      config.proxy.no_proxy = "localhost,127.0.0.1"
      config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true
      config.ssh.insert_key = false
      config.vm.box = opts[:box]
      config.vm.hostname = opts[:name]
      config.vm.provider :virtualbox do |v|
        v.memory = opts[:ram]
        v.cpus = opts[:vcpu]
      end

ansible-labs-101's People

Contributors

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