|
44 | 44 | # shell('echo "#{vmhostname}" > /etc/hostname') |
45 | 45 | # shell("hostname #{vmhostname}") |
46 | 46 | hosts_file = <<-EOS |
47 | | -127.0.0.1 #{vmhostname} |
| 47 | +127.0.0.1 localhost #{vmhostname} kubernetes |
48 | 48 | #{vmipaddr} #{vmhostname} |
49 | 49 | #{vmipaddr} kubernetes |
50 | 50 | EOS |
|
87 | 87 | selector: |
88 | 88 | run: my-nginx |
89 | 89 | EOS |
90 | | - # Return ip adress |
| 90 | + if fact('osfamily') == 'Debian' |
| 91 | + #Installing rubydev environment |
| 92 | + on(host, "apt install ruby-bundler --yes", acceptable_exit_codes: [0]).stdout |
| 93 | + on(host, "apt-get install ruby-dev --yes", acceptable_exit_codes: [0]).stdout |
| 94 | + on(host, "apt-get install build-essential curl git m4 python-setuptools ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev --yes", acceptable_exit_codes: [0]).stdout |
| 95 | + end |
| 96 | + if fact('osfamily') == 'RedHat' |
| 97 | + #Installing rubydev environment |
| 98 | + on(host, "yum install -y ruby-devel git zlib-devel gcc-c++ lib yaml-devel libffi-devel make bzip2 libtool curl openssl-devel readline-devel", acceptable_exit_codes: [0]).stdout |
| 99 | + on(host, "gem install bundler", acceptable_exit_codes: [0]).stdout |
| 100 | + on(host, "git clone git://github.com/sstephenson/rbenv.git .rbenv", acceptable_exit_codes: [0]).stdout |
| 101 | + on(host, "echo 'export PATH=\"$HOME/.rbenv/bin:$PATH\"' >> ~/.bash_profile", acceptable_exit_codes: [0]).stdout |
| 102 | + on(host, "echo 'eval \"$(rbenv init -)\"' >> ~/.bash_profile" ,acceptable_exit_codes: [0]).stdout |
| 103 | + on(host, "git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build", acceptable_exit_codes: [0]).stdout |
| 104 | + on(host, "echo 'export PATH=\"$HOME/.rbenv/plugins/ruby-build/bin:$PATH\"' >> ~/.bash_profile", acceptable_exit_codes: [0]).stdout |
| 105 | + on(host, "source ~/.bash_profile;rbenv install -v 2.3.1;rbenv global 2.3.1;rbenv local 2.3.1", acceptable_exit_codes: [0]).stdout |
| 106 | + end |
| 107 | + |
91 | 108 | # Installing go, cfssl |
| 109 | + on(host, "cd /etc/puppetlabs/code/modules/kubernetes;rm -rf Gemfile.lock;bundle install --path vendor/bundle", acceptable_exit_codes: [0]).stdout |
92 | 110 | on(host, "curl -o go.tar.gz https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz", acceptable_exit_codes: [0]).stdout |
93 | 111 | on(host, "tar -C /usr/local -xzf go.tar.gz", acceptable_exit_codes: [0]).stdout |
94 | | - on(host, "apt-get install git -y", acceptable_exit_codes: [0]).stdout |
95 | 112 | on(host, "export PATH=$PATH:/usr/local/go/bin;go get -u github.com/cloudflare/cfssl/cmd/...", acceptable_exit_codes: [0]).stdout |
96 | | - #Installing rubydev environment |
97 | | - on(host, "apt install ruby-bundler --yes", acceptable_exit_codes: [0]).stdout |
98 | | - on(host, "apt-get install ruby-dev --yes", acceptable_exit_codes: [0]).stdout |
99 | | - on(host, "apt-get install build-essential curl git m4 python-setuptools ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev --yes", acceptable_exit_codes: [0]).stdout |
100 | | - on(host, "cd /etc/puppetlabs/code/modules/kubernetes;rm -rf Gemfile.lock;bundle install --path vendor/bundle", acceptable_exit_codes: [0]).stdout |
101 | 113 | # Creating certs |
102 | | - on(host, "export PATH=$PATH:/usr/local/go/bin;export PATH=$PATH:/root/go/bin;cd /etc/puppetlabs/code/modules/kubernetes/tooling;./kube_tool.rb -f kubernetes -i #{vmipaddr} -b #{vmipaddr} -e \"etcd-#{vmhostname}=http://#{vmipaddr}:2380\" -t \"#{vmipaddr}\" -a \"#{vmipaddr}\" -d true", acceptable_exit_codes: [0]).stdout |
| 114 | + on(host, "source ~/.bash_profile;rbenv global 2.3.1;rbenv local 2.3.1;export PATH=$PATH:/usr/local/go/bin;export PATH=$PATH:/root/go/bin;cd /etc/puppetlabs/code/modules/kubernetes/tooling;./kube_tool.rb -f kubernetes -i #{vmipaddr} -b #{vmipaddr} -e \"etcd-#{vmhostname}=http://#{vmipaddr}:2380\" -t \"#{vmipaddr}\" -a \"#{vmipaddr}\" -d true", acceptable_exit_codes: [0]).stdout |
103 | 115 | create_remote_file(host, "/etc/hosts", hosts_file) |
104 | 116 | create_remote_file(host, "/tmp/nginx.yml", nginx) |
105 | 117 | on(host, 'cp /etc/puppetlabs/code/modules/kubernetes/tooling/kubernetes.yaml /etc/puppetlabs/code/environments/production/hieradata/common.yaml', acceptable_exit_codes: [0]).stdout |
|
0 commit comments