install.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. - hosts: all
  3. become: yes
  4. become_user: root
  5. become_method: sudo
  6. gather_facts: yes
  7. vars:
  8. redis_ports:
  9. - {"port": 19901, "start-hslot": 0, "end-hslot": 1365}
  10. - {"port": 19902, "start-hslot": 1366, "end-hslot": 2730}
  11. - {"port": 19903, "start-hslot": 2731, "end-hslot": 4096}
  12. - {"port": 19904, "start-hslot": 4097, "end-hslot": 5460}
  13. - {"port": 19905, "start-hslot": 5461, "end-hslot": 6826}
  14. - {"port": 19906, "start-hslot": 6827, "end-hslot": 8191}
  15. - {"port": 19907, "start-hslot": 8192, "end-hslot": 9557}
  16. - {"port": 19908, "start-hslot": 9558, "end-hslot": 10921}
  17. - {"port": 19909, "start-hslot": 10922, "end-hslot": 12287}
  18. - {"port": 19910, "start-hslot": 12288, "end-hslot": 13651}
  19. - {"port": 19911, "start-hslot": 13652, "end-hslot": 15017}
  20. - {"port": 19912, "start-hslot": 15018, "end-hslot": 16383}
  21. handlers:
  22. - name: reload_redis_services
  23. command: systemctl daemon-reload
  24. - name: restart_redis_services
  25. systemd:
  26. name: "redis-{{ item['port'] }}"
  27. state: restarted
  28. with_items: "{{ redis_ports }}"
  29. pre_tasks:
  30. - name: Get the Redisraft package
  31. copy:
  32. src: redisraft_0.0.1_x86_64.rpm
  33. dest: /tmp/redisraft_0.0.1_x86_64.rpm
  34. - name: Install the Redisraft package
  35. yum:
  36. name: /tmp/redisraft_0.0.1_x86_64.rpm
  37. state: present
  38. tasks:
  39. - name: Redis Systemd
  40. template:
  41. src: systemd_redis.j2
  42. dest: /lib/systemd/system/redis-{{ item['port'] }}.service
  43. owner: root
  44. group: root
  45. mode: 0644
  46. with_items: "{{ redis_ports }}"
  47. notify:
  48. - reload_redis_services
  49. - restart_redis_services