Skip to content

Commit

Permalink
Add a custom broker.id based in a inventory file
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme Baufaker Rêgo authored and rpelisse committed Oct 12, 2023
1 parent 6a807c5 commit 26485b8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions roles/amq_streams_broker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ broker4
|`amq_streams_broker_auth_listeners` | Default list of authenticated listeners | `PLAINTEXT:PLAINTEXT` |
|`amq_streams_broker_auth_sasl_mechanisms` | Default list of authenticated SASL mechanism | `PLAIN` |
|`amq_streams_broker_inventory_group` | Identify the group of broker nodes | `groups['brokers']` |
|`amq_streams_broker_broker_id` | Identify the broker with specific id in the inventory
|`amq_streams_broker_topics` | List of topics to create. Each topics requires the `name` property, and optionally the `partitions` and `replication_factor`. | |

## Role Variables
Expand Down
2 changes: 1 addition & 1 deletion roles/amq_streams_broker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

- name: "Set server_id for {{ amq_streams_broker.service_name }} service."
ansible.builtin.set_fact:
server_id: "{{ broker_id | default('0') }}"
server_id: "{{ amq_streams_broker_broker_id | default('0') }}"
when:
- not server_id is defined

Expand Down
2 changes: 1 addition & 1 deletion roles/amq_streams_broker/tasks/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
server_start: "{{ amq_streams_broker.server_start }}"
server_config: "{{ amq_streams_broker_config }}"
server_config_template: "{{ amq_streams_broker.config.template }}"
server_id: "{{ broker_id | default('0') }}"
server_id: "{{ amq_streams_broker_broker_id | default('0') }}"
server_user: "{{ amq_streams_broker_user | default(omit) }}"
server_group: "{{ amq_streams_broker_group | default(omit) }}"
server_log_dir: "{{ amq_streams_broker_logs_dir | default(omit) }}"
Expand Down
3 changes: 2 additions & 1 deletion roles/amq_streams_broker/templates/server.properties.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
############################# Server Basics #############################

# The id of the broker. This must be set to a unique integer for each broker.
broker.id={{ amq_streams_broker_inventory_group.index(inventory_hostname) }}
broker.id={{ amq_streams_broker_broker_id | default(amq_streams_broker_inventory_group.index(inventory_hostname)) }}


############################# Socket Server Settings #############################

Expand Down

0 comments on commit 26485b8

Please sign in to comment.