This repository has been archived by the owner on Jul 9, 2020. It is now read-only.
/
kickstart_default_user_data.erb
75 lines (60 loc) · 2.09 KB
/
kickstart_default_user_data.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<%#
kind: user_data
name: Kickstart default user data
model: ProvisioningTemplate
oses:
- CentOS
- Fedora
-%>
<%
rhel_compatible = @host.operatingsystem.family == 'Redhat' && @host.operatingsystem.name != 'Fedora'
# safemode renderer does not support unary negation
pm_set = @host.puppetmaster.empty? ? false : true
puppet_enabled = pm_set || host_param_true?('force-puppet')
salt_enabled = host_param('salt_master') ? true : false
chef_enabled = @host.respond_to?(:chef_proxy) && @host.chef_proxy
-%>
#!/bin/bash
<%# Cloud instances frequently have incorrect hosts data %>
<%= snippet 'fix_hosts' %>
<% if @host.provision_method == 'image' && !root_pass.empty? -%>
# Install the root password
echo 'root:<%= root_pass -%>' | /usr/sbin/chpasswd -e
<% end -%>
<%= snippet 'yum_proxy' %>
<%= snippet 'ntp' %>
<% if rhel_compatible && !host_param_false?('enable-epel') -%>
<%= snippet 'epel' -%>
<% end -%>
<%= snippet 'redhat_register' %>
<% if host_enc['parameters']['realm'] && @host.realm && (@host.realm.realm_type == 'FreeIPA' || @host.realm.realm_type == 'Red Hat Identity Management') -%>
<%= snippet 'freeipa_register' %>
<% end -%>
<% unless host_param_false?('package_upgrade') -%>
# update all the base packages from the updates repository
if [ -f /usr/bin/dnf ]; then
dnf -y update
else
yum -t -y update
fi
<% end -%>
<%= snippet('remote_execution_ssh_keys') %>
<%= snippet "blacklist_kernel_modules" %>
<% if chef_enabled %>
<%= snippet 'chef_client' %>
<% end -%>
<% if puppet_enabled %>
<% if host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
<%= snippet 'puppetlabs_repo' %>
<% end -%>
<%= snippet 'puppet_setup' %>
<% end -%>
<% if salt_enabled %>
<%= snippet 'saltstack_setup' %>
<% end -%>
<% if host_param_true?('ansible_tower_provisioning') -%>
<%= save_to_file('/tmp/ansible_provisioning_call.sh', snippet('ansible_tower_callback_script')) %>
/bin/sh /tmp/ansible_provisioning_call.sh
<% end -%>
# UserData still needs to mark the build as finished
<%= snippet 'built' %>