Commit 0bcbe2b9 authored by shreejit13's avatar shreejit13

adding OS based profiles for rhel7

parent 829171d1
......@@ -53,6 +53,59 @@ roles:
/opt/puppetlabs/bin/puppet module install zack/r10k --version 3.2.0
/opt/puppetlabs/bin/puppet module install abrader/gms --version 1.0.2
/opt/puppetlabs/bin/puppet module install ajcrowe/supervisord --ignore-dependencies --version 0.6.0
/bin/echo '==> Set puppetserver hostname'
/opt/puppetlabs/bin/puppet apply -e 'ini_setting { "set master hostname": ensure => present, section => "main", value => $::fqdn, path => "/etc/puppetlabs/puppet/puppet.conf", setting => "server" }'
/bin/echo '==> Set puppetserver autosign'
/opt/puppetlabs/bin/puppet apply -e 'file { "/etc/puppetlabs/puppet/autosign.conf": ensure => file, content => "$::fqdn\n*\n", }'
/bin/touch /etc/puppetlabs/code/environments/production/manifests/site.pp
/opt/puppetlabs/bin/puppet resource service puppetserver enable=true
/bin/systemctl start puppetserver
/bin/yum groupinstall -y -q "Development Tools" "Development Libraries"
/bin/echo '==> Install + configure foreman and smart proxy'
/opt/puppetlabs/bin/puppet apply /vagrant/manifests/foreman_installation.pp
/opt/puppetlabs/bin/puppet apply -e 'ini_setting { "set foreman report ": ensure => present, section => "main", value => "log,foreman", path => "/etc/puppetlabs/puppet/puppet.conf", setting => "reports" }'
/usr/bin/gem install bundler --no-ri --quiet --no-verbose
/bin/echo '==> /usr/local/bin/bundle install --without mysql2 sqlite test --path vendor'
cd /opt/foreman; /usr/local/bin/bundle install --without mysql2 sqlite test --path vendor --quiet
/bin/echo '==> /usr/local/bin/bundle update foreman_default_hostgroup'
cd /opt/foreman; /usr/local/bin/bundle update foreman_default_hostgroup
/bin/echo '==> RAILS_ENV=production bundle exec rake db:migrate'
RAILS_ENV=production bundle exec rake db:migrate --quiet
/bin/echo '==> RAILS_ENV=production bundle exec rake assets:precompile locale:pack apipie:cache'
RAILS_ENV=production bundle exec rake assets:precompile locale:pack apipie:cache --quiet
/bin/echo '==> RAILS_ENV=production bundle exec rake db:seed'
CREDENTIALS=`RAILS_ENV=production bundle exec rake db:seed --quiet | grep "Login"`
/bin/echo '==> /usr/local/bin/bundle install --without development test --path vendor --quiet'
cd /opt/smart-proxy; /usr/local/bin/bundle install --without development test --path vendor --quiet
cd /opt/smart-proxy; /usr/local/bin/bundle update rubocop
/bin/echo '==> Configure supervisord for foreman and smart-proxy'
/opt/puppetlabs/bin/puppet apply /vagrant/manifests/foreman_post_install.pp
PASSWD=`/bin/echo $CREDENTIALS | awk ' { print $NF } '`
/bin/echo '==> Clear iptables rules'
/sbin/iptables -F
/bin/echo '==> Add new smart proxy to Foreman'
/bin/sleep 20
/bin/curl -k -s -u admin:$PASSWD -H "Accept: version=2,application/json" -H "Content-Type: application/json" -X POST -d '{ "name": "foreman", "url": "https://master.opstheater.vm:8443" } ' http://master.opstheater.vm:3000/api/smart_proxies
/bin/echo '==> Import all puppet classes and environments to Foreman'
/bin/curl -k -s -u admin:$PASSWD -H "Accept: version=2,application/json" -H "Content-Type: application/json" -X POST -d '{ }' http://master.opstheater.vm:3000/api/smart_proxies/1/import_puppetclasses
/bin/echo '==> Create OpsTheater hostgroup'
/bin/curl -k -s -u admin:$PASSWD -H "Accept: version=2,application/json" -H "Content-Type: application/json" -X POST -d '{ "name": "OpsTheater Infra", "environment_id": "1", "puppet_ca_proxy_id": "1", "puppet_proxy_id": "1" } ' http://master.opstheater.vm:3000/api/hostgroups
/bin/echo '==> /bin/systemctl restart puppetserver'
/bin/systemctl restart puppetserver
/bin/echo '==> Setup R10K'
/opt/puppetlabs/bin/puppet apply /vagrant/manifests/r10k_installation.pp
/opt/puppetlabs/puppet/bin/r10k deploy environment -pv
/bin/echo '==> puppet config set hiera_config /etc/puppetlabs/code/environments/production/hiera.yaml'
/opt/puppetlabs/bin/puppet config set hiera_config /etc/puppetlabs/code/environments/production/hiera.yaml
/bin/echo '==> /bin/systemctl restart puppetserver'
/bin/systemctl restart puppetserver
/bin/echo '==> Update Foreman puppet environments'
/bin/curl -k -s -u admin:$PASSWD -H "Accept: version=2,application/json" -H "Content-Type: application/json" -X POST -d '{ }' http://master.opstheater.vm:3000/api/smart_proxies/1/import_puppetclasses
/bin/echo '==> /opt/puppetlabs/bin/puppet agent -t'
/opt/puppetlabs/bin/puppet agent -t || true
/bin/systemctl stop puppet
/bin/echo '==> Foreman URL: http://master.opstheater.vm:3000'
/bin/echo "==> $CREDENTIALS"
pe-puppet-agent:
provisioners:
......@@ -86,7 +139,7 @@ roles:
inline: |-
/sbin/service puppet stop
foss-puppet-agent:
foss-puppet-agent-rhel7:
provisioners:
-
type: hosts
......@@ -100,7 +153,7 @@ roles:
/opt/puppetlabs/bin/puppet config set --section main server master.opstheater.vm
/sbin/service puppet stop
foss-puppet-agent-el6:
foss-puppet-agent-rhel6:
provisioners:
-
type: hosts
......@@ -114,7 +167,7 @@ roles:
/opt/puppetlabs/bin/puppet config set --section main server master.opstheater.vm
/sbin/service puppet stop
foss-puppet-agent-rhel7:
foss-puppet-agent-trusty:
provisioners:
-
type: hosts
......@@ -123,13 +176,9 @@ roles:
-
type: shell
inline: |-
/bin/yum install -y epel-release http://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
/bin/yum install epel-release
/bin/yum install -y puppet-agent
/usr/bin/wget https://apt.puppetlabs.com/puppetlabs-release-pc1-trusty.deb
/usr/bin/dpkg -i puppetlabs-release-pc1-trusty.deb
/usr/bin/apt-get update
/usr/bin/apt-get install puppet-agent
/opt/puppetlabs/bin/puppet config set --section main server master.opstheater.vm
/opt/puppetlabs/bin/puppet agent -t --noop
/opt/puppetlabs/bin/puppet resource service puppet ensure=running
/opt/puppetlabs/bin/puppet module install pcfens/filebeat
/opt/puppetlabs/bin/puppet module install /vagrant/files/puppet-icinga2.tar.gz --ignore-dependencies
/opt/puppetlabs/bin/puppet apply /vagrant/manifests/base/rhel/rhel7.pp
/sbin/service puppet stop
/usr/sbin/service puppet stop
......@@ -10,7 +10,7 @@ vms:
## FOSS puppet master
- name: foss-master
box: foss-master-1-7
box: puppetlabs/centos-7.0-64-nocm
private_networks: [ {ip: '10.20.1.10'} ]
hostname: master.opstheater.vm
roles:
......@@ -22,7 +22,7 @@ vms:
private_networks: [ {ip: '10.20.1.20'} ]
hostname: icinga2.opstheater.vm
roles:
- foss-puppet-agent
- foss-puppet-agent-rhel7
## elasticsearch + kibana
- name: elasticsearch
......@@ -30,7 +30,7 @@ vms:
private_networks: [ {ip: '10.20.1.30'} ]
hostname: elasticsearch.opstheater.vm
roles:
- foss-puppet-agent-el6
- foss-puppet-agent-rhel6
## gitlab + gitlabci + matter most
- name: gitlab
......@@ -38,7 +38,7 @@ vms:
private_networks: [ {ip: '10.20.1.50'} ]
hostname: gitlab.opstheater.vm
roles:
- foss-puppet-agent
- foss-puppet-agent-rhel7
## mysql
- name: mysql
......@@ -46,7 +46,7 @@ vms:
private_networks: [ {ip: '10.20.1.60'} ]
hostname: mysql.opstheater.vm
roles:
- foss-puppet-agent
- foss-puppet-agent-rhel7
- name: peclient
box: puppetlabs/centos-7.0-64-nocm
......@@ -55,16 +55,16 @@ vms:
roles:
- pe-puppet-agent
- name: fossclient
- name: fossclient-rhel7
box: puppetlabs/centos-7.0-64-nocm
private_networks: [ {ip: '10.20.1.201'} ]
hostname: fossclient.opstheater.vm
hostname: fossrhel7.opstheater.vm
roles:
- foss-puppet-agent
- foss-puppet-agent-rhel7
- name: fossclient-rhel7
box: puppetlabs/centos-7.0-64-nocm
- name: fossclient-ubuntutrusty
box: puppetlabs/ubuntu-14.04-64-nocm
private_networks: [ {ip: '10.20.1.202'} ]
hostname: fossclientrhel7.opstheater.vm
hostname: fosstrusty.opstheater.vm
roles:
- foss-puppet-agent-rhel7
- foss-puppet-agent-trusty
......@@ -22,6 +22,15 @@ node 'mysql.opstheater.vm' {
include opstheater::role::database::standalone
}
node 'fosstrusty.opstheater.vm' {
include opstheater::role::client::fosstrusty
}
node 'fossrhel7.opstheater.vm' {
include opstheater::role::client::fossrhel7
}
node default {
include opstheater::role::testclient
fail ('node $::fqdn unknown to site.pp')
}
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