Replaced self_service.sh with service.py

This commit is contained in:
2022-03-14 21:58:25 +01:00
parent cdca807aa0
commit e7f26fbf6f
6 changed files with 217 additions and 70 deletions

View File

@ -14,9 +14,10 @@
<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=192.168.56.16 dbname=test user=postgres password=coolshit");
$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 {
@ -27,5 +28,6 @@
var_dump(pg_fetch_all($result));
?>
</p>
{% endif %}
</body>
</html>

View File

@ -63,7 +63,7 @@
become: yes
community.postgresql.postgresql_user:
name: postgres
password: coolshit
password: "{{ psql_pass }}"
- name: Restart postgresql service
service:
name: postgresql