34 lines
1.2 KiB
Django/Jinja
34 lines
1.2 KiB
Django/Jinja
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Hello</title>
|
|
</head>
|
|
|
|
<body>
|
|
<h1><?php echo 'Hello, World!'; ?></h1>
|
|
<p>Hostname: {{ ansible_facts.nodename }}</p>
|
|
<p>OS: {{ ansible_facts.distribution }} {{ ansible_facts.distribution_version }}</p>
|
|
<p>Kernel: {{ ansible_facts.kernel }}</p>
|
|
<p>Memory usage: {{ ansible_facts.memfree_mb }}/{{ ansible_facts.memtotal_mb }}MB</p>
|
|
<p>Python version: {{ ansible_facts.python_version }}</p>
|
|
{% if groups['postgresql'] is defined and groups['postgresql']|length > 0 %}
|
|
<p>
|
|
<?php
|
|
$db_handle = pg_connect("host={{ groups['postgresql'][0] }} dbname=test user=postgres password={{ hostvars[groups['postgresql'][0]]['psql_pass'] }}");
|
|
if ($db_handle) {
|
|
echo "Connection attempt succeeded.\n";
|
|
} else {
|
|
echo "Connection attempt failed.\n";
|
|
}
|
|
$query = "SELECT m.* FROM test.public.message m";
|
|
$result = pg_exec($db_handle, $query);
|
|
var_dump(pg_fetch_all($result));
|
|
?>
|
|
</p>
|
|
{% endif %}
|
|
</body>
|
|
</html>
|