Created
March 31, 2022 15:51
-
-
Save ivorscott/57b3dfca57c78c4aa26cfe23ad6ffddd to your computer and use it in GitHub Desktop.
Ubuntu VM startup script
This file contains 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
#!/bin/bash | |
sudo apt update | |
sudo apt install apache2 -y | |
sudo systemctl enable apache2 | |
sudo systemctl start apache2 | |
tpl="<html> | |
<head> | |
<title>Example</title> | |
<style> | |
.container { | |
font-family:arial; | |
padding: 15px; | |
} | |
.title { | |
color:#127FBF; | |
} | |
</style> | |
</head> | |
<body> | |
<div class='container'> | |
<h1 class='title'>Deployed with Terraform!</h1> | |
<ul> | |
<li>Internal hostname: $(hostname -f)</li> | |
</ul> | |
</div> | |
<script> | |
const publicName = document.location.hostname; | |
const list = document.getElementsByTagName('ul')[0]; | |
const item = document.createElement('li'); | |
const text = document.createTextNode('External hostname: ' + publicName); | |
item.appendChild(text); | |
list.appendChild(item); | |
</script> | |
</body> | |
</html>" | |
sudo echo $tpl > /var/www/html/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment