rsyslog_install.sh 1.05 KB
#! /bin/bash
#source /home/master/ansible/ansible/hacking/env-setup
work_path=$(dirname $(readlink -f $0))

module=''
inventory=${work_path}/hosts
ssh_key=''
user=''

usage(){
        echo " sh rsyslog_install.sh -m module -i hosts -u user -s private_key
               this command will install rsyslog on module in hosts , ssh hosts with user and private_key
             "
}


install(){
    ansible-playbook -i ${inventory} -u ${user} --private-key ${ssh_key} -s --extra-vars "src_path=${work_path} module=${module}" rsyslog.yaml
    exit 0
}

while [ $# -gt 0 ];do
    case $1 in
        -m)
            shift
            module=$1
            shift
            ;;
        -i)
            shift
            inventory=$1
            shift
	    ;;
        -s)
            shift
            ssh_key=$1
            shift
            ;;
        -u)
            shift
            user=$1
            shift
            ;;
        -h)
            usage
            exit 0
            ;;
        \?)
            usage
            exit 1
            ;;
    esac
done

install