YanChii / ansible-role-postgres-ha

Create postgresql HA auto-failover cluster using pcs, pacemaker and PAF
Apache License 2.0
33 stars 22 forks source link

how about adding REDIS option #11

Closed frank3427 closed 7 years ago

frank3427 commented 7 years ago

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

YanChii commented 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.

frank3427 commented 7 years ago

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.

frank3427 commented 7 years ago

jan,

do you have a redis role that your willing to share?

YanChii commented 7 years ago

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.

frank3427 commented 7 years ago

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

redis cluster resources

- name: Print results

debug: msg="{{ resource_exist.results }}"

tags: [config_cluster, redis]

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"}

YanChii commented 7 years ago

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

  1. really should know what you're doing
  2. really should use a separate role for redis (added after the postres-ha in the roles list so the cluster gets installed before the redis role run)

The error message suggests that you've probably omitted some variable definition from the original role and thus it is undefined now. J.