Closed frank3427 closed 7 years ago
Hi @frank3427,
The ansible roles are about separation of duties. That means if you want to add something completely different, you should create a new role.
From quick look at the role you linked, it should play nicely if you put it after the postgres-ha
role.
Jan
PS: even this role can be separated into two roles: pcs-cluster
and postgres-ha
. I'll probably do this in the future. It will make the roles more flexible.
That is exactly what I was thinking, one could use pcs-cluster for other services , like redis, postgres, apache ..... the list is endles I am trying to add the redis as an option to yours.
I tried his role, but his role fails allover and its not as clean as yours.
jan,
do you have a redis role that your willing to share?
Unfortunately, I don't have a redis role. The installation and adding the resource is easy. But the hard thing is that you need to know how the redis (or any other service) behaves in the cluster and handles a failover.
the other role, is doing that. the issue I am having with it is the checks that he has are all failing. when I say check I mean he has a ask to detect if the resource exists. example
but they fail; TASK [postgres-ha : Set fatcs about if resources already exists] *** fatal: [dbs03.prodea-int.net]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'ansible.vars.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'stdout'\n\nThe error appears to have been in '/etc/ansible/roles/postgres-ha/tasks/redis_resources.yml': line 17, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set fatcs about if resources already exists\n ^ here\n"} fatal: [dbs04.prodea-int.net]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'ansible.vars.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'stdout'\n\nThe error appears to have been in '/etc/ansible/roles/postgres-ha/tasks/redis_resources.yml': line 17, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set fatcs about if resources already exists\n ^ here\n"}
Why there's redis_resources.yml
file under postgres-ha/tasks
? If you're trying to disassemble the original redis role and integrate it into the postgres-ha
role, you
The error message suggests that you've probably omitted some variable definition from the original role and thus it is undefined now. J.
Jan,
how about adding a redis option to the role. take a look at this, https://github.com/albertobaselga/redis-cluster/blob/master/roles/redis-cluster/defaults/main.yml https://github.com/albertobaselga/redis-cluster/blob/master/roles/redis-cluster/tasks/redis_install.yml https://github.com/albertobaselga/redis-cluster/blob/master/roles/redis-cluster/tasks/cluster_resources.yml