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

Optional dependencies are still required #57

Closed acehead closed 5 years ago

acehead commented 5 years ago

Hi,

When running role with patroni_dcs_exists: true set on inventory level execution fails with missing dependencies error (below). This should not happen as dependencies are not needed in this case

The error appears to have been in '/ansible-role-patroni/meta/main.yml': line 29, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

dependencies:
  - role: brianshumate.consul
    ^ here
kostiantyn-nemchenko commented 5 years ago

Hi, @acehead

Thanks for your interest in this project. The when conditional is not applied to the 'role loading', it is appended to each task in the role. So first Ansible expects to find locally all 3 roles (brianshumate.consul, andrewrothstein.etcd-cluster, AnsibleShipyard.ansible-zookeeper) within the dependencies section and only then it applies the conditional when: not patroni_dcs_exists to each task in those roles. Just install the role using ansible-galaxy install kostiantyn-nemchenko.patroni and all required dependencies will be installed automatically.

acehead commented 5 years ago

Ahha, thanks for clarification, pretty counterintuitive Ansible behavior. We are using your role as a part of a bigger internal set of cookbooks and roles and not using Ansible Galaxy. For now I believe I will comment the dependencies out, as for our case they are not needed