You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
762 B
24 lines
762 B
<html>
|
|
<head>
|
|
<title>Ansible Application</title>
|
|
</head>
|
|
<body>
|
|
</br>
|
|
<a href=http://{{ ansible_default_ipv4.address }}/index.html>Homepage</a>
|
|
</br>
|
|
<?php
|
|
Print "Hello, World! I am a web server configured using Ansible and I am : ";
|
|
echo exec('hostname');
|
|
Print "</BR>";
|
|
echo "List of Databases: </BR>";
|
|
{% for host in groups['dbservers'] %}
|
|
$link = mysqli_connect('{{ hostvars[host].ansible_default_ipv4.address }}', '{{ hostvars[host].dbuser }}', '{{ hostvars[host].upassword }}') or die(mysqli_connect_error($link));
|
|
{% endfor %}
|
|
$res = mysqli_query($link, "SHOW DATABASES;");
|
|
while ($row = mysqli_fetch_assoc($res)) {
|
|
echo $row['Database'] . "\n";
|
|
}
|
|
?>
|
|
</body>
|
|
</html>
|
|
|
|
|