2013-03-12 17:35:25 +01:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Ansible Application</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
</br>
|
|
|
|
<a href=http://{{ ansible_eth0.ipv4.address }}/index.html>Homepage</a>
|
|
|
|
</br>
|
|
|
|
<?php
|
2013-03-20 05:40:06 +01:00
|
|
|
Print "Hello, World! I am a web server configured using Ansible and I am : ";
|
2013-03-12 17:35:25 +01:00
|
|
|
echo exec('hostname');
|
|
|
|
Print "</BR>";
|
|
|
|
echo "List of Databases: </BR>";
|
|
|
|
{% for host in groups['dbservers'] %}
|
|
|
|
$link = mysql_connect('{{ hostvars[host].ansible_eth0.ipv4.address }}', '{{ hostvars[host].dbuser }}', '{{ hostvars[host].upassword }}') or die(mysql_error());
|
|
|
|
{% endfor %}
|
|
|
|
$res = mysql_query("SHOW DATABASES");
|
|
|
|
while ($row = mysql_fetch_assoc($res)) {
|
|
|
|
echo $row['Database'] . "\n";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|