<%#
kind: user_data
name: Cloud-init
-%>
#cloud-config
hostname: <%= @host.shortname %>
<%# Allow user to specify additional SSH key as host paramter -%>
<% if @host.params['sshkey'].present? || @host.params['remote_execution_ssh_keys'].present? -%>
ssh_authorized_keys:
<% if @host.params['sshkey'].present? -%>
- <%= @host.params['sshkey'] %>
<% end -%>
<% if @host.params['remote_execution_ssh_keys'].present? -%>
<% @host.params['remote_execution_ssh_keys'].each do |key| -%>
- <%= key %>
<% end -%>
<% end -%>
<% end -%>
runcmd:
- |
#!/bin/bash
<%= indent 4 do
snippet 'subscription_manager_registration'
end %>
<% if @host.info['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'Red Hat Identity Management' -%>
<%= indent 4 do
snippet 'idm_register'
end %>
<% end -%>
<% unless @host.operatingsystem.atomic? -%>
# update all the base packages from the updates repository
yum -t -y -e 0 update
<% end -%>
<%
# safemode renderer does not support unary negation
non_atomic = @host.operatingsystem.atomic? ? false : true
pm_set = @host.puppetmaster.empty? ? false : true
puppet_enabled = non_atomic && (pm_set || @host.params['force-puppet'])
%>
<% if puppet_enabled %>
yum install -y puppet
cat > /etc/puppet/puppet.conf << EOF
<%= indent 4 do
snippet 'puppet.conf'
end %>
EOF
# Setup puppet to run on system reboot
/sbin/chkconfig --level 345 puppet on
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
/sbin/service puppet start
<% end -%>
phone_home:
url: <%= foreman_url('built') %>
post: []
tries: 10pp
<%#
kind: user_data
name: Cloud-init
-%>
#cloud-config
hostname: <%= @host.shortname %>
<%# Allow user to specify additional SSH key as host paramter -%>
<% if @host.params['sshkey'].present? || @host.params['remote_execution_ssh_keys'].present? -%>
ssh_authorized_keys:
<% if @host.params['sshkey'].present? -%>
- <%= @host.params['sshkey'] %>
<% end -%>
<% if @host.params['remote_execution_ssh_keys'].present? -%>
<% @host.params['remote_execution_ssh_keys'].each do |key| -%>
- <%= key %>
<% end -%>
<% end -%>
<% end -%>
runcmd:
- |
#!/bin/bash
<%= indent 4 do
snippet 'subscription_manager_registration'
end %>
<% if @host.info['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'Red Hat Identity Management' -%>
<%= indent 4 do
snippet 'idm_register'
end %>
<% end -%>
<% unless @host.operatingsystem.atomic? -%>
# update all the base packages from the updates repository
yum -t -y -e 0 update
<% end -%>
<%
# safemode renderer does not support unary negation
non_atomic = @host.operatingsystem.atomic? ? false : true
pm_set = @host.puppetmaster.empty? ? false : true
puppet_enabled = non_atomic && (pm_set || @host.params['force-puppet'])
%>
<% if puppet_enabled %>
yum install -y puppet
cat > /etc/puppet/puppet.conf << EOF
<%= indent 4 do
snippet 'puppet.conf'
end %>
EOF
# Setup puppet to run on system reboot
/sbin/chkconfig --level 345 puppet on
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
/sbin/service puppet start
<% end -%>
phone_home:
url: <%= foreman_url('built') %>
post: []
tries: 10pp
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow