0

i am trying to install puppet master with automation on vm, I am using shell scripting for this but i am entering IP address of puppet master vm in puppet configuration.

but i need to update the IP address automatically so how can i define that fuction in shell Script

I have attached my shell script code for referance

#!/bin/bash
if [ $# -eq 0 ]
  then
    echo "No hostname supplied"
    exit
fi
env=$1
echo $env
hostname=`hostname`
apt-get update -y
apt-get upgrade -y
wget http://apt.puppetlabs.com/puppetlabs-release-trusty.deb
dpkg -i puppetlabs-release-trusty.deb
apt-get update -y
apt-get -y install puppetmaster
sed -i "s/$hostname/$env/g" /etc/hostname
sed -i "s/no/yes/g"  /etc/default/puppetmaster
echo "127.0.0.1  puppet.example.net    puppet" >>  /etc/hosts
echo "172.31.44.238  puppet.example.net    puppet" >>  /etc/hosts
reboot

i want to setup this IP address automtically capture throught my VM

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.