kostiantyn-nemchenko / ansible-role-patroni

:elephant: Ansible Role for Patroni
https://galaxy.ansible.com/kostiantyn-nemchenko/patroni
MIT License
68 stars 44 forks source link

Fix: Change the order of variable declarations #89

Closed TACY-octo closed 3 years ago

TACY-octo commented 3 years ago

Hello,

Scenario :

When running the role for Redhat, the variable postgresql_yum_repo_pkg_name is defined after the variable postgresql_yum_repo_url although it has not yet been defined just before.

Bug :

fatal: [postgres1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: https://download.postgresql.org/pub/repos/yum/reporpms/{{ 'F' if ansible_distribution|lower == 'fedora' else 'EL' }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}/{{ postgresql_yum_repo_pkg_name }}: 'postgresql_yum_repo_pkg_name' is undefined\n\nThe error appears to be in '/Users/cyril.tavian/.cache/molecule/wrapper_postgres-ha/default/roles/patroni/tasks/variables.yml': line 21, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n  block:\n    - name: Define postgresql_yum_repo_url.\n      ^ here\n"}

Solution : Move the variable postgresql_yum_repo_pkg_name before the variable postgresql_yum_repo_url so that it is defined.

kostiantyn-nemchenko commented 3 years ago

Merged, thank you @ctavian !