ansible-st2 icon indicating copy to clipboard operation
ansible-st2 copied to clipboard

(feature request) Adding tasks to set up cluster configuration in the RabbitMQ role

Open userlocalhost opened this issue 8 years ago • 4 comments

This is a much-needed project for us. I want to build StackStorm in production environment with this.

The current tasks in the RabbitMQ role just only install package and start service. But the RabbitMQ servers that I expect are set up a cluster configuration.

I want some tasks to set up cluster configuration in the RabbitMQ role.

Thank you.

userlocalhost avatar Feb 14 '17 08:02 userlocalhost

Thanks for the feature request! I agree, cluster and HA-friendly deployment is must have story for production use.

And while it may take a lot of time to implement it, - all dependent services we have like RabbitMQ, Mongo, PostgreSQL could have a lot of advanced configuration to handle.

But for now I'd suggest alternative approach. st2 role was written without hard dependency on internal rabbitmq role. So instead of https://github.com/StackStorm/ansible-st2/issues/120 you can use external rabbitmq role and Configure with Existing Mongo, RabbitMQ, PostgreSQL installations #17

All we need now is to add respective ~st2.conf messaging setting~ (done) in ansible-st2 so you could configure st2 to work with external rabbitmq cluster, deployed by another Ansible role.

Resulting play may look this way:

---
- name: Configure RabbitMQ cluster
  hosts: rabbitmq-cluster
  roles:
    # See: https://github.com/alexey-medvedchikov/ansible-rabbitmq
    - alexeymedvedchikov.rabbitmq
      vars:
        rabbitmq_create_cluster: yes
        rabbitmq_erlang_cookie: st2-mq
        rabbitmq_users:
          - user: st2
            password: st2
            vhost: /
            configure_priv: .*
            read_priv: .*
            write_priv: .*
            tags: st2

- name: Install StackStorm
  hosts: st2
  roles:
    - name: Install and Configure `st2` itself
      role: st2
      vars:
        st2_messaging_url: "amqp://st2:st2@rabbitmq-cluster001:5672//"

    - st2mistral
    - st2web
    - st2smoketests

Just for reference I found external Ansible Galaxy role alexeymedvedchikov.rabbitmq which configures rabbitmq cluster https://github.com/alexey-medvedchikov/ansible-rabbitmq just to give an idea (I haven't tested it).

Approach like that with external rabbitmq cluster would be fast to do & efficient and I'd suggest to follow that way, but if you prefer long-term, - I'm fine with contributions too :+1: @userlocalhost Let me know your opinion.

arm4b avatar Feb 15 '17 14:02 arm4b

cc @bigmstone I remember you was interested in deploying entire StackStorm in HA way internally. This might be useful discussion for you.

arm4b avatar Feb 15 '17 14:02 arm4b

Thank you for your reply. I agree with you. It's reasonable to use some external playbook that specialize in a specific target, as you say.

So I'll close #120, then seek a playbook that suits the following requirements.

  • can set up a cluster and HA queue.
  • can add a user and set permissions of it for connecting from external node.

After that, I think I'll write a test for it.

userlocalhost avatar Feb 16 '17 06:02 userlocalhost

Thought I would also chime in here and share an already available RabbitMQ Ansible role of mine which also provides HA. I would also be interested in helping out in anyway possible as well.

https://github.com/mrlesmithjr/ansible-rabbitmq

mrlesmithjr avatar Mar 12 '17 01:03 mrlesmithjr