• LOGIN
  • No products in the cart.

DevOps on AWS – Vagrant Provisioning with Shell Script

# Vagrant File:

# -*- mode: ruby -*-

# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = “2”

ENV[‘VAGRANT_DEFAULT_PROVIDER’] = ‘virtualbox’
HOST_IP = ‘192.168.56.65’

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

config.vm.define “ubuntutest1” do |ubuntutest1|
ubuntutest1.vm.hostname = “ubuntutest1.rnstech.com”
ubuntutest1.vm.box = “ubuntu/trusty64”
ubuntutest1.vm.box_url = “ubuntu/trusty64”
ubuntutest1.vm.network :private_network,
      ip: HOST_IP,
      netmask: ‘255.255.255.0’
    ubuntutest1.vm.synced_folder ‘html’, ‘/var/www/html’
    ubuntutest1.vm.synced_folder ‘puppet’, ‘/etc/puppet’
ubuntutest1.vm.provision ‘shell’, path: ‘provision.sh’
end

config.vm.define “ubuntudev1” do |ubuntudev1|

ubuntudev1.vm.hostname = “ubuntudev1.rnstech.com”
ubuntudev1.vm.box = “ubuntu/trusty64”
ubuntudev1.vm.box_url = “ubuntu/trusty64”
ubuntudev1.vm.network :private_network,
      ip: ‘192.168.56.66’,
      netmask: ‘255.255.255.0’
    ubuntudev1.vm.synced_folder ‘html’, ‘/var/www/html’
    ubuntudev1.vm.synced_folder ‘puppet’, ‘/etc/puppet’
ubuntudev1.vm.provision “shell”, inline: <<-SHELL
    apt-get update
  apt-get install -y apache2
  wget http://apt.puppetlabs.com/puppetlabs-release-squeeze.deb
  dpkg -i puppetlabs-release-squeeze.deb

  SHELL

end
end

======================================================


Shell Script File: (provision.sh)

#!/bin/bash -eu

# provision.sh — Install Apache and a test PHP script

# Install Apache and PHP

apt-get update -y  
apt-get install -y apache2 php5 libapache2-mod-php5 php5-mcrypt

# Start the service

sudo service apache2 status
/etc/init.d/apache2 status
ps aux | grep apache
which php
cat > /var/www/html/index.php << EOF
<?php phpinfo(); ?>
EOF


Run Cmd:

> vagrant up
February 22, 2021

0 responses on "DevOps on AWS - Vagrant Provisioning with Shell Script"

    All rights reserved.
    error: Alert: Content is protected !!
    X