Created
February 10, 2017 21:01
-
-
Save b-long/22d7d0216c84ac178e13702aac389002 to your computer and use it in GitHub Desktop.
Experimental cloud-init file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
# Based on http://www.marcoberube.com/archives/272 | |
# MiqProvisionAmazon_Web.yaml | |
# CloudForms - Cloud-Init Script for Apache Installation on EC2 | |
# For troubleshooting check: /var/lib/cloud/instance/user-data.txt & /var/log/boot.log | |
<% # Set Global Variables | |
role = evm[:role] | |
role ||= evm[:ws_values][:role] rescue 'web' | |
instance_name = evm[:vm_target_name] | |
key_pair = evm[:keypair] | |
key_pair ||= evm[:ws_values][:keypair] rescue nil %> | |
bootcmd: | |
## Turn off SELinux | |
- setenforce 0 | |
ssh_authorized_keys: | |
<% if key_pair.nil? %> | |
- echo "WARN --: Using default key pari" | |
<% else %> | |
- <%=key_pair%> | |
<% end %> | |
runcmd: | |
## Setup motd and root authorized keys | |
- echo Welcome to Red Hat CloudForms <%=role.titlecase%> Instance <%=instance_name%> > /etc/motd | |
## Turn off firewall | |
- echo "CloudForms - Turning off firewall" | |
- chkconfig iptables off | |
- service iptables stop | |
## Install Apache | |
- echo "CloudForms - Installing apache" | |
- yum -y install httpd wget | |
- service httpd start | |
- chkconfig httpd on | |
## Modify default apache homepage | |
- echo "CloudForms - Modifyig default apache homepage" | |
- echo 'Customized by b-long' > /var/www/html/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment