galaxyproject / ansible-postgresql

An Ansible role for managing a PostgreSQL server
https://galaxy.ansible.com/galaxyproject/postgresql
122 stars 58 forks source link

postgresql_backup_remote_rsync_path is undefined #10

Closed rubencabrera closed 6 years ago

rubencabrera commented 7 years ago

From a role where I used the core modules for postgres to install and create users and db's, I included ansible-postgresql to make automated backups.

- name: Copias de seguridad                                           
  include_role:                                                       
    name: postgresql                                                  
  become: True                                                        
  vars:                                                               
     postgresql_backup_dir: /backups                                   
   tags:                                                               
     - a_tag                                                            
     - another_tag

Then, calling the playbook with: $ ansible-playbook main-playbook.yml --tags another_tag -K

I get an error when installing the backup scripts:


TASK [postgresql : Install backup scripts] ***************************************************************
ok: [my_server] => (item=backup_working_wal.sh)
failed: [my_server] (item=archive_wal.sh) => {"failed": true, "item": "archive_wal.sh", "msg": "AnsibleUndefinedVariable: 'postgresql_backup_remote_rsync_path' is undefined"}
failed: [my_server] (item=scheduled_backup.sh) => {"failed": true, "item": "scheduled_backup.sh", "msg": "AnsibleUndefinedVariable: 'postgresql_backup_remote_rsync_path' is undefined"}

I guess it's just a matter of specifying that variable, but as the readme says all vars are optional, maybe it should be clarified or given a default value.

Thanks for the role, anyway, gonna save me a lot of time!

rubencabrera commented 7 years ago

I added an if variable_name is defined on the template and the role works, but I suspect the backup script is going to fail.