Skip to content

Commit

Permalink
[upd] adds test ability
Browse files Browse the repository at this point in the history
- check connectivity when postgresql not stopped
  • Loading branch information
Carrol Cox committed Aug 3, 2020
1 parent ab73395 commit 664c3d6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
*.orig
*.tmp
*.log

*/__pycache__
*.pyc
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ pganalyze_group: pganalyze

pganalyze_service_state: restarted

pganalyze_postgresql_state: started

pganalyze_api_key: ''
pganalize_server_api_key: ''
pganalyze_db_name: '*'
Expand Down
14 changes: 9 additions & 5 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
---
# handlers file for ansible-pganalyze-collector
- name: restart pganalyze-collector
- name: handle pganalyze-collector service state is 'pgbouncer_service_state'
service:
name: pganalyze-collector
state: "{{ pganalyze_service_state }}"
enabled: true
notify:
- test pganalyze-collector
listen:
- restart pganalyze-collector

- name: test pganalyze-collector
- name: Check pganalyze-collector connectivity
command: |
pganalyze-collector --test
register: pganalyze_test_result
changed_when: false
ignore_errors: false
failed_when:
- pganalyze_test_result.rc == 0
- "'Test submission successful' not in pganalyze_test_result.stderr"
when:
- pganalyze_service_state != 'stopped'
- pganalyze_postgresql_state != 'stopped'
listen:
- restart pganalyze-collector
2 changes: 2 additions & 0 deletions tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@
environment:
DEBIAN_FRONTEND: noninteractive
RUNLEVEL: 1
notify:
- restart pganalyze-collector

0 comments on commit 664c3d6

Please sign in to comment.