Commit 81cbbd79 authored by Walter Heck's avatar Walter Heck

Initial work on setting up a yum repo server locally

parent 48bab738
Pipeline #398 passed with stages
in 3 minutes and 14 seconds
...@@ -30,6 +30,16 @@ vms: ...@@ -30,6 +30,16 @@ vms:
- foss-puppet-agent-rhel7 - foss-puppet-agent-rhel7
- managed-host - managed-host
## repo server
- name: repo
box: puppetlabs/centos-7.2-64-nocm
private_networks: [ {ip: '10.20.1.70'} ]
hostname: repo.opstheater.vm
roles:
- foss-puppet-agent-rhel7
- managed-host
- memory-4g
## elasticsearch + kibana ## elasticsearch + kibana
- name: elasticsearch - name: elasticsearch
box: puppetlabs/centos-7.2-64-nocm box: puppetlabs/centos-7.2-64-nocm
......
#!/bin/bash
echo "Running setup-repo.sh"
# colorize some of the output, see http://dcmnt.me/1XYnkPe for more information
COLOR_OK=$(tput setaf 2)
COLOR_ERR=$(tput setaf 1)
COLOR_OFF=$(tput sgr0)
COLOR_BRIGHT=$(tput bold)
SIGN_OK="${COLOR_OFF} ${COLOR_OK}${COLOR_OFF}"
SIGN_ERR="${COLOR_OFF} ${COLOR_ERR}${COLOR_OFF}"
function log {
case $2 in
norm)
message="${COLOR_BRIGHT}${1}${COLOR_OFF}"
;;
ok)
message="${COLOR_OK}${1}${COLOR_OFF}"
;;
err)
message="${COLOR_ERR}${1}${COLOR_OFF}"
;;
esac
echo "$message" >&2
}
#convert all hyphens and forward slashes to underscore
PUPPET_ENV=$(echo $GIT_BRANCH | tr '.\-/' _)
log "==> stopping firewalld service" norm
if [ -f /usr/lib/systemd/system/firewalld.service ]; then
service firewalld stop || { log "==> $SIGN_ERR failed to stop firewalld service" err ; exit 1; }
elif [ -f /usr/lib/systemd/system/iptables.service ]; then
service iptables stop || { log "==> $SIGN_ERR failed to stop iptables service" err; exit 1; }
else
log "no firewalld or iptables service found" norm
fi
log "==> $SIGN_OK OK:stopping firewalld service" ok
# log "==> installing necessary yum repositories and foreman-installer" norm
# if rpm -q puppetlabs-release-pc1-el-7; then
# log "==> puppetlabs-release-pc1-el-7 already installed, skipping" norm
# else
# rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm || { log "==> $SIGN_ERR failed to install puppetlabs pc1 rpm" err; exit 1; }
# fi
#
# if rpm -q epel-release; then
# log "==> epel-release already installed, skipping" norm
# else
# yum -y install epel-release || { log "==> $SIGN_ERR failed to install epel-release" err; exit 1; }
# fi
#
# if rpm -q foreman-release; then
# log "==> foreman-release already installed, skipping" norm
# else
# yum -y install https://yum.theforeman.org/releases/1.13/el7/x86_64/foreman-release.rpm || { log "==> $SIGN_ERR failed to install foreman-release" err; exit 1; }
# fi
# log "==> stopping firewalld service" norm
# if [ -f /usr/lib/systemd/system/firewalld.service ]; then
# service firewalld stop || { log "==> $SIGN_ERR failed to stop firewalld service" err ; exit 1; }
# elif [ -f /usr/lib/systemd/system/iptables.service ]; then
# service iptables stop || { log "==> $SIGN_ERR failed to stop iptables service" err; exit 1; }
# else
# log "no firewalld or iptables service found" norm
# fi
# log "==> $SIGN_OK OK:stopping firewalld service" ok
# log "==> running puppet agent" norm
# /opt/puppetlabs/bin/puppet agent -t --detailed-exitcodes
# if [ $? == 4 ] || [ $? == 6 ]; then
# log "==> $SIGN_ERR puppet agent run encountered errors" err
# exit 1
# fi
# log "==> $SIGN_OK OK: running puppet agent" ok
#
# /opt/puppetlabs/bin/puppet resource service firewalld ensure=stopped enable=false
# echo "Finishing setup-foss-master.sh"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment