update rabbitmq role
This commit is contained in:
parent
c43815c9b6
commit
8a4b36ff3f
@ -4,5 +4,5 @@ rabbitmq_cluster_name: "default"
|
||||
rabbitmq_admin_username: "admin"
|
||||
rabbitmq_app_users: ""
|
||||
rabbitmq_vhosts: ""
|
||||
rabbitmq_plugins: "rabbitmq_management,rabbitmq_shovel,rabbitmq_prometheus"
|
||||
rabbitmq_plugins: "rabbitmq_management,rabbitmq_shovel,rabbitmq_prometheus,rabbitmq_shovel_management"
|
||||
rabbitmq_collect_statistics_interval: 30000
|
||||
|
||||
@ -1,2 +1,4 @@
|
||||
{{ ansible_managed }}
|
||||
|
||||
[Service]
|
||||
LimitNOFILE=65536
|
||||
|
||||
9
roles/rabbitmq/files/logrotate
Normal file
9
roles/rabbitmq/files/logrotate
Normal file
@ -0,0 +1,9 @@
|
||||
{{ ansible_managed }}
|
||||
|
||||
/var/log/rabbitmq/*.log {
|
||||
daily
|
||||
missingok
|
||||
rotate 7
|
||||
compress
|
||||
notifempty
|
||||
}
|
||||
@ -32,33 +32,85 @@
|
||||
state: absent
|
||||
tags: config
|
||||
|
||||
- name: Create vhosts
|
||||
community.rabbitmq.rabbitmq_vhost:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items: "{{ rabbitmq_vhosts }}"
|
||||
tags: config,users,vhosts
|
||||
|
||||
- name: Create admin user
|
||||
community.rabbitmq.rabbitmq_user:
|
||||
user: "{{ rabbitmq_admin_username }}"
|
||||
password: "{{ rabbitmq_admin_password }}"
|
||||
vhost: /
|
||||
vhost: "{{ item }}"
|
||||
configure_priv: .*
|
||||
read_priv: .*
|
||||
write_priv: .*
|
||||
state: present
|
||||
tags: administrator
|
||||
tags: config
|
||||
|
||||
- name: Create vhosts
|
||||
community.rabbitmq.rabbitmq_vhost:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items: "{{ rabbitmq_vhosts }}"
|
||||
tags: config,users
|
||||
|
||||
- name: Create checkmk user
|
||||
community.rabbitmq.rabbitmq_user:
|
||||
user: "{{ rabbitmq_checkmk_username }}"
|
||||
password: "{{ rabbitmq_checkmk_password }}"
|
||||
vhost: /
|
||||
configure_priv: ""
|
||||
read_priv: .*
|
||||
write_priv: ""
|
||||
state: present
|
||||
tags: monitoring
|
||||
tags: config
|
||||
|
||||
- name: Create exchanges
|
||||
community.rabbitmq.rabbitmq_exchange:
|
||||
name: "{{ item.name }}"
|
||||
type: "{{ item.type }}"
|
||||
vhost: "{{ item.vhost }}"
|
||||
state: present
|
||||
login_user: "{{ rabbitmq_admin_username }}"
|
||||
login_password: "{{ rabbitmq_admin_password }}"
|
||||
with_items: "{{ rabbitmq_exchanges }}"
|
||||
tags: config,exchanges
|
||||
|
||||
- name: Create queues
|
||||
community.rabbitmq.rabbitmq_queue:
|
||||
login_user: "{{ rabbitmq_admin_username }}"
|
||||
login_password: "{{ rabbitmq_admin_password }}"
|
||||
state: "{{ item.state | default('present')}}"
|
||||
vhost: "{{ item.vhost }}"
|
||||
name: "{{ item.name }}"
|
||||
durable: "{{ item.durable | default(true) }}"
|
||||
dead_letter_exchange: "{{ item.dead_letter_exchange | default() }}"
|
||||
dead_letter_routing_key: "{{ item.dead_letter_routing_key | default() }}"
|
||||
arguments: "{{ item.arguments | default({}) }}"
|
||||
with_items: "{{ rabbitmq_queues }}"
|
||||
tags: config,queues
|
||||
|
||||
- name: Create bindings
|
||||
community.rabbitmq.rabbitmq_binding:
|
||||
login_user: "{{ rabbitmq_admin_username }}"
|
||||
login_password: "{{ rabbitmq_admin_password }}"
|
||||
state: "{{ item.state |default('present') }}"
|
||||
vhost: "{{ item.vhost }}"
|
||||
name: "{{ item.name }}"
|
||||
destination: "{{ item.destination }}"
|
||||
destination_type: "{{ item.destination_type }}"
|
||||
routing_key: "{{ item.routing_key }}"
|
||||
arguments: "{{ item.arguments | default({}) }}"
|
||||
with_items: "{{ rabbitmq_bindings }}"
|
||||
tags: config,bindings
|
||||
|
||||
- name: Create app users
|
||||
community.rabbitmq.rabbitmq_user:
|
||||
user: "{{ item.username }}"
|
||||
password: "{{ item.password }}"
|
||||
vhost: "{{ item.vhost }}"
|
||||
read_priv: .*
|
||||
write_priv: .*
|
||||
configure_priv: .*
|
||||
read_priv: "{{ item.read_priv | default('.*') }}"
|
||||
write_priv: "{{ item.write_priv | default('.*') }}"
|
||||
configure_priv: "{{ item.configure_priv | default('.*') }}"
|
||||
state: present
|
||||
tags: monitoring,management
|
||||
with_items: "{{ rabbitmq_app_users }}"
|
||||
|
||||
@ -133,3 +133,12 @@
|
||||
group: rabbitmq
|
||||
notify: Restart Rabbitmq
|
||||
tags: install
|
||||
|
||||
- name: Deploy logrotate conf
|
||||
ansible.builtin.copy:
|
||||
src: logrotate
|
||||
dest: /etc/logrotate.d/rabbitmq-server
|
||||
mode: 0644
|
||||
user: root
|
||||
group: root
|
||||
tags: install
|
||||
|
||||
@ -6,4 +6,4 @@
|
||||
|
||||
- name: Import config tasks
|
||||
ansible.builtin.include_tasks: config.yml
|
||||
tags: config,users
|
||||
tags: config,users,queues,vhosts,exchanges,bindings
|
||||
|
||||
@ -3,6 +3,10 @@
|
||||
# Limit to 70% of RAM
|
||||
vm_memory_high_watermark.relative = 0.7
|
||||
|
||||
# Tuning raft WAL log file https://rabbitmq.com/quorum-queues.html#segment-entry-count
|
||||
raft.segment_max_entries = 32768
|
||||
raft.wal_max_size_bytes = 32000000
|
||||
|
||||
####################
|
||||
#
|
||||
# Cluster settings
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user