falkorlib 0.8.5 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/falkorlib/bootstrap/base.rb +20 -13
  4. data/lib/falkorlib/bootstrap/git.rb +5 -2
  5. data/lib/falkorlib/bootstrap/mkdocs.rb +3 -4
  6. data/lib/falkorlib/bootstrap/vagrant.rb +9 -3
  7. data/lib/falkorlib/cli.rb +34 -175
  8. data/lib/falkorlib/cli/link.rb +5 -1
  9. data/lib/falkorlib/cli/make.rb +15 -1
  10. data/lib/falkorlib/cli/new.rb +22 -5
  11. data/lib/falkorlib/tasks/rspec.rake +29 -9
  12. data/lib/falkorlib/version.rb +1 -1
  13. data/spec/falkorlib/bootstrap_spec.rb +26 -1
  14. data/spec/falkorlib/bootstrap_vagrant_spec.rb +14 -14
  15. data/templates/README/header_readme.erb +18 -21
  16. data/templates/README/readme_pyenv.erb +44 -0
  17. data/templates/mkdocs/docs/README.md.erb +7 -7
  18. data/templates/mkdocs/docs/contributing/setup.md.erb +3 -3
  19. data/templates/mkdocs/docs/layout.md.erb +25 -4
  20. data/templates/mkdocs/docs/setup.md.erb +315 -0
  21. data/templates/mkdocs/docs/vagrant.md.erb +85 -0
  22. data/templates/mkdocs/mkdocs.yml.erb +5 -4
  23. data/templates/vagrant/Vagrantfile.erb +73 -28
  24. data/templates/vagrant/vagrant/config.yaml.sample +8 -4
  25. data/templates/vagrant/vagrant/puppet/Makefile +40 -0
  26. data/templates/vagrant/vagrant/puppet/hiera.yaml +36 -0
  27. data/templates/vagrant/vagrant/puppet/hieradata/.gitignore +2 -0
  28. data/templates/vagrant/vagrant/puppet/hieradata/defaults.yaml +4 -0
  29. data/templates/vagrant/vagrant/puppet/hieradata/roles/example.yaml +13 -0
  30. data/templates/vagrant/vagrant/puppet/manifests/default.pp +23 -0
  31. data/templates/vagrant/vagrant/puppet/modules/.gitignore +3 -0
  32. data/templates/vagrant/vagrant/puppet/site/profiles/manifests/pxe/server.pp +12 -0
  33. data/templates/vagrant/vagrant/{bootstrap.sh → scripts/bootstrap.sh} +27 -30
  34. data/templates/vagrant/vagrant/shared/.gitignore +3 -0
  35. metadata +15 -6
  36. data/templates/mkdocs/docs/setup/README.md.erb +0 -6
  37. data/templates/mkdocs/docs/setup/install.md.erb +0 -61
  38. data/templates/mkdocs/docs/setup/preliminaries.md.erb +0 -73
@@ -2,12 +2,13 @@ site_name: <%= config[:sitename] %>
2
2
  nav:
3
3
  - Home: 'index.md'
4
4
  - Organization: 'layout.md'
5
- - Getting Started:
6
- - Pre-Requisites: 'setup/preliminaries.md'
7
- - Installation: 'setup/install.md'
5
+ - Pre-Requisites and Repository Setup: 'setup.md'
6
+ <% if File.exists?(File.join(config[:rootdir], 'Vagrantfile')) %>
7
+ - Overview of the Vagrant configuration: 'vagrant.md'
8
+ <% end %>
8
9
  - Contributing:
9
10
  - Overview: 'contributing/index.md'
10
11
  - Directory Layout: 'layout.md'
11
- - Repository Setup and Developments: 'contributing/setup.md'
12
+ - Repository Setup and Git Developments: 'contributing/setup.md'
12
13
  - Semantic Versioning: 'contributing/versioning.md'
13
14
  theme: readthedocs
@@ -1,6 +1,6 @@
1
1
  # -*- mode: ruby -*-
2
2
  # vi: set ft=ruby :
3
- # Time-stamp: <Fri 2018-04-27 16:53 svarrette>
3
+ # Time-stamp: <Mon 2020-04-20 15:32 svarrette>
4
4
  ###########################################################################################
5
5
  # __ __ _ __ _ _
6
6
  # \ \ / /_ _ __ _ _ __ __ _ _ __ | |_ / _(_) | ___
@@ -11,7 +11,6 @@
11
11
  ###########################################################################################
12
12
  require 'yaml'
13
13
  require 'ipaddr'
14
- require 'deep_merge'
15
14
  require 'pp'
16
15
  require 'erb'
17
16
 
@@ -19,17 +18,19 @@ require 'erb'
19
18
  # For more information on the below plugins:
20
19
  # - https://github.com/oscar-stack/vagrant-hosts
21
20
  # - https://github.com/dotless-de/vagrant-vbguest
22
- # - https://github.com/emyl/vagrant-triggers
23
21
  # - https://github.com/fgrehm/vagrant-cachier
22
+ # - https://github.com/vagrant-libvirt/vagrant-libvirt
24
23
  # Terminal-table is a nice ruby gem for automatically print tables with nice layout
25
24
  ###
26
25
  [ 'vagrant-hosts',
27
26
  'vagrant-vbguest',
28
- 'vagrant-triggers',
29
27
  'vagrant-cachier',
28
+ # 'vagrant-libvirt',
29
+ 'deep_merge',
30
30
  'terminal-table' ].each do |plugin|
31
31
  abort "Install the '#{plugin}' plugin with 'vagrant plugin install #{plugin}'" unless Vagrant.has_plugin?("#{plugin}")
32
32
  end
33
+ require 'deep_merge'
33
34
  require 'terminal-table'
34
35
 
35
36
  ### Global variables ###
@@ -39,6 +40,8 @@ VAGRANTFILE_API_VERSION = "2"
39
40
  # Eventually a local YAML configuration for the deployment
40
41
  TOP_SRCDIR = File.expand_path File.dirname(__FILE__)
41
42
  TOP_CONFDIR = File.join(TOP_SRCDIR, 'vagrant')
43
+ TOP_PUPPETDIR = File.join(TOP_CONFDIR, 'puppet')
44
+ TOP_PUPPET_MODULEDIR = File.join(TOP_PUPPETDIR, 'modules')
42
45
  config_file = File.join(TOP_CONFDIR, 'config.yaml')
43
46
 
44
47
  #SHARED_DIR = File.join('vagrant', 'shared')
@@ -61,6 +64,7 @@ DEFAULT_SETTINGS = {
61
64
  },
62
65
  # Default Boxes
63
66
  :boxes => {
67
+ :centos8 => '<%= config[:boxes][:centos8] %>',
64
68
  :centos7 => '<%= config[:boxes][:centos7] %>',
65
69
  :debian8 => '<%= config[:boxes][:debian8] %>',
66
70
  :ubuntu14 => '<%= config[:boxes][:ubuntu14] %>'
@@ -72,7 +76,9 @@ DEFAULT_SETTINGS = {
72
76
  # :os: <os> # from the configured boxes
73
77
  # :ram: <ram>
74
78
  # :vcpus: <vcpus>
75
- # :role: <role> # supported: [ 'XX', 'YY' ]
79
+ # :role: <role> # Puppet role
80
+ # :puppet_modules => [ ... ]
81
+ # :provider => <provider> # if not virtualbox (Ex: 'libvirt')
76
82
  :vms => {
77
83
  # IF in single mode, below is the definition of the box to deploy
78
84
  'default' => {
@@ -84,7 +90,7 @@ DEFAULT_SETTINGS = {
84
90
 
85
91
  # List of default provisioning scripts
86
92
  DEFAULT_PROVISIONING_SCRIPTS = [
87
- "vagrant/bootstrap.sh"
93
+ "vagrant/scripts/bootstrap.sh"
88
94
  ]
89
95
 
90
96
  # Load the settings (eventually overwritten using values from the yaml file 'config/vagrant.yaml')
@@ -96,13 +102,13 @@ if File.exist?(config_file)
96
102
  end
97
103
  #puts settings.to_yaml
98
104
  # abort 'end'
99
- #pp settings
100
105
  abort "Undefined settings" if settings.nil?
101
106
 
102
107
  ############################################################
103
108
  # Complete configuration of the boxes to deploy
104
- defaults = settings[:defaults]
105
- network = settings[:network]
109
+ defaults = settings[:defaults]
110
+ network = settings[:network]
111
+ puppet_dir = File.join('vagrant', 'puppet') # Relative path to Local puppet directory
106
112
 
107
113
 
108
114
  ############################################################
@@ -128,6 +134,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
128
134
  ## Uncomment the below part if you want and additional shared directory
129
135
  # config.vm.synced_folder "vagrant/shared", "/shared", mount_options: ['dmode=777','fmode=777'],
130
136
  # type: "virtualbox" # Shared directory for users
137
+ if Dir.exist?(File.join(TOP_PUPPETDIR, 'hieradata'))
138
+ config.vm.synced_folder "#{puppet_dir}/hieradata", "/tmp/vagrant-puppet/hieradata", type: "virtualbox"
139
+ end
131
140
 
132
141
  # network settings
133
142
  ipaddr = IPAddr.new network[:range]
@@ -137,7 +146,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
137
146
  # cosmetics for the post-up message
138
147
  __table = {
139
148
  :title => "Virtual environment deployed on Vagrant",
140
- :headings => [ 'Name', 'Hostname', 'OS', 'vCPU/RAM', 'Description', 'IP' ],
149
+ :headings => [ 'Name', 'Hostname', 'OS', 'vCPU/RAM', 'Role', 'Description', 'IP' ],
141
150
  :rows => [],
142
151
  }
143
152
 
@@ -146,12 +155,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
146
155
  settings[:vms].each do |name, node|
147
156
  hostname = node[:hostname] ? node[:hostname] : name
148
157
  domain = network[:domain]
149
- fqdn = "#{hostname}.#{domain}"
150
- os = node[:os] ? node[:os].to_sym : defaults[:os].to_sym
151
- ram = node[:ram] ? node[:ram] : defaults[:ram]
152
- vcpus = node[:vcpus] ? node[:vcpus] : defaults[:vcpus]
153
- role = node[:role] ? node[:role] : 'default'
154
- desc = node[:desc] ? node[:desc] : 'n/a'
158
+ fqdn = "#{hostname}.#{domain}"
159
+ boxname = defaults[:os].to_s.downcase.gsub(/([^\d]+)(\d+)/, '\\1-\\2')
160
+ name = boxname if name == 'default'
161
+ os = node[:os] ? node[:os].to_sym : defaults[:os].to_sym
162
+ ram = node[:ram] ? node[:ram] : defaults[:ram]
163
+ vcpus = node[:vcpus] ? node[:vcpus] : defaults[:vcpus]
164
+ role = node[:role] ? node[:role] : 'default'
165
+ desc = node[:desc] ? node[:desc] : 'n/a'
166
+ puppet_modules = node[:puppet_modules] ? node[:puppet_modules] : []
155
167
 
156
168
  abort "Non-existing box OS '#{os}' for the VM '#{name}'" if settings[:boxes][os.to_sym].nil?
157
169
  abort "Empty IP address range" if ip_range.empty?
@@ -171,19 +183,52 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
171
183
  end
172
184
 
173
185
  # role specialization
174
- if role == 'XX'
175
- c.vm.provision "shell" do |s|
176
- s.path = "scripts/XX_install.sh"
177
- s.args = [ '--debug' ]
178
- s.keep_color = true
179
- end
186
+ # if role == 'XX'
187
+ # c.vm.provision "shell" do |s|
188
+ # s.path = "scripts/XX_install.sh"
189
+ # s.args = [ '--debug' ]
190
+ # s.keep_color = true
191
+ # end
192
+ # end
193
+
194
+ ########## PUPPET PROVISIONNING #########
195
+ # Install required puppet modules, if any
196
+ puppet_modules.each do |mod|
197
+ config.vm.provision "shell",
198
+ inline: "puppet module install --target-dir #{TOP_PUPPET_MODULEDIR} #{mod}"
180
199
  end
181
- end
182
- __table[:rows] << [ name, fqdn, os.to_sym, "#{vcpus}/#{ram}", desc, ip]
183
- end # settings
184
200
 
185
- config.trigger.after :up do
186
- puts Terminal::Table.new __table
187
- end
201
+ # A role fact MUST be defined (default: 'default') as it is used in Hiera config
202
+ c.vm.provision "shell",
203
+ inline: "echo '{ \"role\": \"#{role}\" }' > /opt/puppetlabs/facter/facts.d/custom.json",
204
+ keep_color: true
205
+ ################ Puppet install ##############
206
+ c.vm.provision "puppet" do |puppet|
207
+ puppet.options = [
208
+ '--verbose',
209
+ '-t',
210
+ # '--debug',
211
+ "--yamldir /vagrant/#{puppet_dir}/hieradata",
212
+ ]
213
+ # Does not work :(
214
+ # puppet.facter = { "role" => "#{role}" }
215
+ puppet.hiera_config_path = "#{puppet_dir}/hiera.yaml"
216
+ puppet.module_path = [ "#{puppet_dir}/site", "#{puppet_dir}/modules" ]
217
+ puppet.manifests_path = "#{puppet_dir}/manifests"
218
+ puppet.manifest_file = File.exists?("/vagrant/#{puppet_dir}/manifests/#{role}.pp") ? "#{role}.pp" : 'default.pp'
219
+ end # puppet
220
+
221
+ __table[:rows] << [ name, fqdn, os.to_sym, "#{vcpus}/#{ram}", role, desc, ip]
222
+
223
+ if settings[:vms].keys.last == name
224
+ c.trigger.after :up do |trigger|
225
+ trigger.info = (Terminal::Table.new __table).to_s
226
+ trigger.warn = <<-EOF
227
+ - Virtual Vagrant infrastructure successfully deployed!
228
+ EOF
229
+ end
230
+ end
188
231
 
232
+ end # config.vm.define
233
+ end # settings
189
234
  end
@@ -1,5 +1,5 @@
1
1
  # -*- mode: yaml; -*-
2
- # Time-stamp: <Fri 2018-04-27 16:47 svarrette>
2
+ # Time-stamp: <Sat 2020-04-18 18:00 svarrette>
3
3
  ################################################################################
4
4
  # Complementary configuration for Vagrant
5
5
  # You can overwrite here the default settings defined in ../Vagrantfile and
@@ -11,6 +11,7 @@
11
11
  # Format:
12
12
  # :<os><version>: <username>/<box> # see https://vagrantcloud.com
13
13
  # :boxes:
14
+ # :centos8: 'centos/8'
14
15
  # :centos7: 'centos/7'
15
16
  # :debian8: 'debian/contrib-jessie64'
16
17
  # :ubuntu14: 'ubuntu/trusty64'
@@ -28,8 +29,6 @@
28
29
  # :network:
29
30
  # :domain: 'vagrant.dev' # network domain to use
30
31
  # :range: '10.10.1.0/24' # IP range to use
31
- # :client_ip_start_offset: 100 # Note: compute nodes will have xx.xx.xx.254
32
- # # client/compute nodes VMs will start on xx.xx.xx.<client_ip_start_offset+1>
33
32
 
34
33
  #___________________________________________________________
35
34
  # VMs / Vagrant boxes to define apart from the compute nodes
@@ -40,7 +39,10 @@
40
39
  # :os: <os> # from the configured boxes
41
40
  # :ram: <ram>
42
41
  # :vcpus: <vcpus>
43
- # :role: <role> # supported: [ 'controller', 'frontend' ]
42
+ # :role: <role>
43
+ # :puppet_modules:
44
+ # - '<name1>-<mod1>'
45
+ # - '<name2>-<mod2>'
44
46
  #
45
47
  # :vms:
46
48
  # 'anothervm':
@@ -49,3 +51,5 @@
49
51
  # :vcpus: 2
50
52
  # :desc: 'VM #2 (secondary)'
51
53
  # :role: role2
54
+ # :puppet_modules:
55
+ # - ...
@@ -0,0 +1,40 @@
1
+ ##################################################################################
2
+ # Makefile - Configuration file for GNU make (http://www.gnu.org/software/make/)
3
+ # Time-stamp: <Wed 2020-04-15 13:13 svarrette>
4
+ #
5
+ # Copyright (c) 2018 Sebastien Varrette <Sebastien.Varrette@uni.lu>
6
+ #
7
+ ############################## Variables Declarations ############################
8
+
9
+ CURDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
10
+
11
+ MODULES_DIR = modules
12
+ MANIFESTS_DIR = manifests
13
+ HIERADATA_DIR = hieradata
14
+
15
+ MODULES = $(sort $(dir $(wildcard $(MODULES_DIR)/*/)))
16
+
17
+ # all: setup
18
+
19
+ # .PHONY: setup
20
+ # setup:
21
+ # r10k puppetfile install -v
22
+ # $(MAKE) check
23
+
24
+ # check:
25
+ # puppet module --modulepath $(CURDIR)/modules --color true list --tree
26
+
27
+ info:
28
+ @echo "MODULES = $(MODULES)"
29
+
30
+ clean:
31
+ @if [ -f "$(HIERADATA_DIR)/custom.yaml" ]; then \
32
+ echo "=> remove custom hiera"; \
33
+ rm -f $(HIERADATA_DIR)/custom.yaml;\
34
+ fi
35
+
36
+ distclean: clean
37
+ @if [ -n "$(MODULES)" ]; then \
38
+ echo "=> remove puppet modules"; \
39
+ echo "(simulating) rm -rf $(MODULES_DIR)/*";\
40
+ fi
@@ -0,0 +1,36 @@
1
+ # -*- mode: yaml; -*-
2
+ # Time-stamp: <Wed 2020-04-15 10:29 svarrette>
3
+ ################################################################################
4
+ # _ _ _ ____ __ _
5
+ # | | | (_) ___ _ __ __ _ / ___|___ _ __ / _(_) __ _
6
+ # | |_| | |/ _ \ '__/ _` | | | / _ \| '_ \| |_| |/ _` |
7
+ # | _ | | __/ | | (_| | | |__| (_) | | | | _| | (_| |
8
+ # |_| |_|_|\___|_| \__,_| \____\___/|_| |_|_| |_|\__, |
9
+ # |___/
10
+ ################################################################################
11
+ # Puppet Hiera configuration, which is used to configure the hierarchy, which
12
+ # backend(s) to use, and settings for each backend.
13
+ # - Doc: https://docs.puppet.com/puppet/latest/hiera_config_yaml_5.html
14
+ #
15
+ ---
16
+ version: 5 # below version 5 are deprecated starting puppet 4.9
17
+
18
+ ### default datadir and backend for hierarchy levels.
19
+ defaults: # Used for any hierarchy level that omits these keys.
20
+ datadir: hieradata # Should be absolute with vagrant
21
+ data_hash: yaml_data # Use the built-in YAML backend.
22
+
23
+ hierarchy:
24
+ #______________________
25
+ - name: "Custom data"
26
+ path: "custom.yaml"
27
+ #___________________________
28
+ - name: "Role Specific data"
29
+ path: "roles/%{::role}.yaml"
30
+ #______________________
31
+ - name: "Local settings (eventually from vagrant config)"
32
+ path: "locals.yaml"
33
+ #______________________
34
+ - name: "Default data" # Human-readable name.
35
+ path: "defaults.yaml" # File path, relative to datadir.
36
+ # ^^^^^ IMPORTANT: include the file extension!
@@ -0,0 +1,2 @@
1
+ locals.yaml
2
+ custom.yaml
@@ -0,0 +1,4 @@
1
+ # Default Hiera values for Puppet
2
+ ---
3
+
4
+ msg: "Vagrant provisioning with Hiera enabled"
@@ -0,0 +1,13 @@
1
+ # -*- mode: yaml -*-
2
+ # Time-stamp: <Wed 2020-04-15 16:28 svarrette>
3
+ ###########################################################################
4
+ # Puppet hiera settings for 'example' role
5
+ ---
6
+
7
+ # Profiles key may be used to include profile classes
8
+ profiles:
9
+ - '::profiles::pxe::server'
10
+
11
+ msg: 'Provisioning Sample PXE server'
12
+
13
+ pxe::syslinux_version: 'system'
@@ -0,0 +1,23 @@
1
+ # File:: <tt>default.pp</tt>
2
+ # Author:: UL HPC Team (<hpc-team@uni.lu>)
3
+ # Copyright:: Copyright (c) 2020 Sebastien Varrette
4
+ # License:: Apache-2.0
5
+ #
6
+ # ------------------------------------------------------------------------------
7
+ node default {
8
+ # Setup pre and post run stages
9
+ # Typically these are only needed in special cases but are good to have
10
+ stage { ['pre', 'post']: }
11
+ Stage['pre'] -> Stage['main'] -> Stage['post']
12
+ Package{ ensure => 'present' }
13
+
14
+ # Check that the hiera configuration is working...
15
+ # if not the puppet provisioning will fail.
16
+ $msg=lookup('msg')
17
+ notice("Role: ${::role}")
18
+ notice("Welcome Message: '${msg}'")
19
+
20
+ if (lookup('profiles', undef, undef, false)) {
21
+ lookup('profiles', {merge => unique}).contain
22
+ }
23
+ }
@@ -0,0 +1,3 @@
1
+ *
2
+
3
+ !.gitignore
@@ -0,0 +1,12 @@
1
+ # -*- mode: puppet; -*-
2
+ # Time-stamp: <Wed 2020-04-15 16:28 svarrette>
3
+ ###########################################################################################
4
+ # Profile (base) class used for a PXE server general settings
5
+ #
6
+ # Documentation on puppet/pxe class: https://forge.puppet.com/puppet/pxe
7
+
8
+ class profiles::pxe::server
9
+ {
10
+ include ::tftp
11
+ include ::pxe
12
+ }
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bash
2
- # Time-stamp: <Fri 2018-04-27 15:53 svarrette>
2
+ # Time-stamp: <Sun 2020-04-19 12:39 svarrette>
3
3
  ###########################################################################################
4
4
  # __ __ _ ____ _ _
5
5
  # \ \ / /_ _ __ _ _ __ __ _ _ __ | |_ | __ ) ___ ___ | |_ ___| |_ _ __ __ _ _ __
6
6
  # \ \ / / _` |/ _` | '__/ _` | '_ \| __| | _ \ / _ \ / _ \| __/ __| __| '__/ _` | '_ \
7
- # \ V / (_| | (_| | | | (_| | | | | |_ | |_) | (_) | (_) | |_\__ \ |_| | | (_| | |_) |
7
+ # \ V / (_| | (_| | | | (_| | | | | |_ | |_) | (_) | (_) | |_\__ \ |_| | | (_| | |_) |
8
8
  # \_/ \__,_|\__, |_| \__,_|_| |_|\__| |____/ \___/ \___/ \__|___/\__|_| \__,_| .__/
9
9
  # |___/ |_|
10
- # Copyright (c) 2017 Sebastien Varrette <sebastien.varrette@uni.lu>
10
+ # Copyright (c) 2017-2020 Sebastien Varrette <sebastien.varrette@uni.lu>
11
11
  ###########################################################################################
12
12
  # (prefered) way to see a Vagrant box configured.
13
13
  #
@@ -23,21 +23,15 @@ STARTDIR="$(pwd)"
23
23
  SCRIPTFILENAME=$(basename $0)
24
24
  SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
25
25
 
26
-
27
26
  MOTD="/etc/motd"
28
27
  DOTFILES_DIR='/etc/dotfiles.d'
29
28
  DOTFILES_URL='https://github.com/ULHPC/dotfiles.git'
30
29
  EXTRA_PACKAGES=
31
30
 
32
- # List of default packages to install
33
- COMMON_DEFAULT_PACKAGES="wget figlet git screen bash-completion rsync nmap vim python-pip htop direnv"
34
-
35
- # Easybuild
36
- #export EASYBUILD_MODULES_TOOL=Lmod
37
- export EASYBUILD_MODULE_NAMING_SCHEME=CategorizedModuleNamingScheme
38
- EB_INSTALL_SCRIPT='/tmp/bootstrap_eb.py'
39
- EB_INSTALL_SCRIPT_URL='https://raw.githubusercontent.com/easybuilders/easybuild-framework/develop/easybuild/scripts/bootstrap_eb.py'
31
+ TITLE=$(hostname -s)
40
32
 
33
+ # List of default packages to install
34
+ COMMON_DEFAULT_PACKAGES="ruby wget figlet git screen bash-completion rsync vim htop net-tools mailx"
41
35
 
42
36
  ######
43
37
  # Print information in the following form: '[$2] $1' ($2=INFO if not submitted)
@@ -69,28 +63,26 @@ EOF
69
63
 
70
64
  ####################### Per OS Bootstrapping function ##########################
71
65
  setup_redhat() {
66
+ info "fix screen title"
67
+ touch /etc/sysconfig/bash-prompt-screen
68
+ chmod +x /etc/sysconfig/bash-prompt-screen
69
+
72
70
  info "Running yum update"
73
71
  yum update -y >/dev/null
74
72
 
75
73
  info "Installing default packages"
76
74
  yum install -y epel-release
77
- yum install -y ${COMMON_DEFAULT_PACKAGES} bind-utils ${EXTRA_PACKAGES} >/dev/null
78
-
79
- info "Uninstalling (eventually) existing Puppet installation"
80
- yum erase -y puppet puppetlabs-release >/dev/null
81
-
82
- info "Adding repo for Puppet 4"
83
- rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-$1.noarch.rpm
75
+ yum install -y ${COMMON_DEFAULT_PACKAGES} ruby-devel gdbm-devel bind-utils ${EXTRA_PACKAGES} >/dev/null
84
76
 
85
77
  sleep 1
86
- info "Installing Puppet and its dependencies"
87
- yum install -y puppet-agent >/dev/null
88
-
89
- info "installing Environment modules and LMod"
90
- yum install -y environment-modules Lmod
91
-
92
78
  yum groupinstall -y "Development Tools"
93
- yum install -y openssl-devel libssl-dev libopenssl-devel ncurses-devel libibverbs-dev libibverbs-devel, rdma-core-devel bzip2-devel readline-devel libsqlite3x-devel
79
+
80
+ # get OS version
81
+ os_version=$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release))
82
+ info "Adding Puppet Labs repo and installing Puppet for RHEL/CentOS ${os_version}"
83
+ # Get the major version
84
+ yum install -y https://yum.puppetlabs.com/puppet-release-el-$(echo $os_version | cut -d '.' -f 1).noarch.rpm
85
+ yum install -y puppet
94
86
  }
95
87
 
96
88
  setup_apt() {
@@ -190,8 +182,14 @@ setup_motd() {
190
182
  EOF
191
183
  if [ -n "${has_figlet}" ]; then
192
184
  cat <<EOF >> ${motd}
193
- $(${has_figlet} -w 80 -c "Virtual $(hostname -s)")
185
+ $(${has_figlet} -w 100 -c "Virt. ${TITLE}")
194
186
  EOF
187
+ if [ -n "${SUBTITLE}" ]; then
188
+ echo "$(${has_figlet} -w 100 -c \"${SUBTILE}\")" >> ${motd}
189
+ fi
190
+ fi
191
+ if [ -n "${DESC}" ]; then
192
+ echo "${DESC}" >> ${motd}
195
193
  fi
196
194
  cat <<EOF >> ${motd}
197
195
  ================================================================================
@@ -202,7 +200,6 @@ EOF
202
200
  EOF
203
201
  }
204
202
 
205
-
206
203
  ######################################################################################
207
204
  [ $UID -gt 0 ] && error "You must be root to execute this script (current uid: $UID)"
208
205
 
@@ -228,8 +225,8 @@ case "$OSTYPE" in
228
225
  *) echo "unknown: $OSTYPE"; exit 1;;
229
226
  esac
230
227
 
231
- [ -f /usr/bin/puppet ] || ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet
232
- [ -f /usr/bin/facter ] || ln -s /opt/puppetlabs/puppet/bin/facter /usr/bin/facter
228
+ # [ -f /usr/bin/puppet ] || ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet
229
+ # [ -f /usr/bin/facter ] || ln -s /opt/puppetlabs/puppet/bin/facter /usr/bin/facter
233
230
 
234
231
  setup_dotfiles
235
232
  setup_motd