Skip to content

Add additional ha-policy parameters #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions roles/activemq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ Sample divert:
|`activemq_systemd_wait_for_log` | Whether systemd unit should wait for service to be up in logs | `True` when `activemq_ha_enabled` and `activemq_shared_storage` are both `True` |
|`activemq_systemd_wait_for_timeout`| How long to wait for service to be alive (seconds) | `60` |
|`activemq_systemd_wait_for_delay`| Activation delay for service systemd unit | `10` |
|`activemq_ha_allow_failback`| Whether a server will automatically stop when another places a request to take over its place |`true` |
|`activemq_ha_failover_on_shutdown`| Will this backup server become active on a normal server shutdown | `true` |
|`activemq_ha_restart_backup`| Will this server, if a backup, restart once it has been stopped because of failback or scaling down | `false` |
|`activemq_ha_check_for_active_server`| Whether to check the cluster for a live server using our own server ID when starting up. This option is only necessary for performing 'fail-back' on replicating servers | `false` |
|`activemq_ha_replication_cluster_name`| Name of the cluster configuration to use for replication. This setting is only necessary in case you configure multiple cluster connections | `""` |
|`activemq_ha_replication_group_name`| With replication, if set, remote backup servers will only pair with primary servers with matching group-name | `""` |


#### Multi-site fault-tolerance (AMQP broker connections)
Expand Down
7 changes: 7 additions & 0 deletions roles/activemq/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ activemq_systemd_wait_for_log: "{{ activemq_ha_enabled and activemq_shared_stora
activemq_systemd_wait_for_timeout: 60
activemq_systemd_wait_for_delay: 10
activemq_ha_role: live-only
activemq_ha_allow_failback: true
activemq_ha_failover_on_shutdown: true
activemq_ha_restart_backup: false
activemq_ha_check_for_active_server: "{{ activemq_replication }}"
activemq_ha_replication_cluster_name: ''
activemq_ha_replication_group_name: ''


### Masked passwords
activemq_password_codec: 'org.apache.activemq.artemis.utils.DefaultSensitiveStringCodec'
Expand Down
42 changes: 40 additions & 2 deletions roles/activemq/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -691,12 +691,50 @@ argument_specs:
description: "Whether to enable the message counters"
activemq_message_counter_sample_period:
default: 10000
type: int
type: "int"
description: "The sample period (in ms) to use for message counters"
activemq_message_counter_max_day_history:
default: 10
type: int
type: "int"
description: "How many days to keep message counter history"
activemq_ha_allow_failback:
default: true
type: "bool"
description: >
Whether a server will automatically stop when a another places a request to take over
its place. The use case is when a regular server stops and its backup takes over its
duties, later the main server restarts and requests the server (the former backup) to
stop operating
activemq_ha_failover_on_shutdown:
default: true
type: "bool"
description: "Will this backup server become active on a normal server shutdown"
activemq_ha_restart_backup:
default: false
type: "bool"
description: >
Will this server, if a backup, restart once it has been stopped because of failback or
scaling down
activemq_ha_check_for_active_server:
default: "{{ activemq_replication }}"
type: "bool"
description: >
Whether to check the cluster for a (live) server using our own server ID when starting
up. This option is only necessary for performing 'fail-back' on replicating
servers.
activemq_ha_replication_cluster_name:
default: ""
type: "str"
description: >
Name of the cluster configuration to use for replication. This setting is only necessary in
case you configure multiple cluster connections. It is used by a replicating backups and by
primary servers that may attempt fail-back
activemq_ha_replication_group_name:
default: ""
type: "str"
description: >
With replication, if set, remote backup servers will only pair with primary servers with
matching group-name
systemd:
options:
activemq_version:
Expand Down
34 changes: 24 additions & 10 deletions roles/activemq/templates/ha_policy.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,39 @@
<shared-store>
{% if activemq_ha_role == 'slave' or activemq_ha_role == 'backup' %}
<{{ activemq_ha_role }}>
<allow-failback>true</allow-failback>
<allow-failback>{{ activemq_ha_allow_failback | lower }}</allow-failback>
<restart-backup>{{ activemq_ha_restart_backup | lower }}</restart-backup>
</{{ activemq_ha_role }}>
{% elif activemq_ha_role == 'master' or activemq_ha_role == 'primary' %}
<{{ activemq_ha_role }}>
<failover-on-shutdown>{{ activemq_ha_failover_on_shutdown | lower }}</failover-on-shutdown>
</{{ activemq_ha_role }}>
{% else %}
<master>
<failover-on-shutdown>true</failover-on-shutdown>
</master>
{% endif %}
</shared-store>
{% endif %}
{% if activemq_ha_enabled and activemq_replication %}
<replication>
{% if activemq_ha_role == 'slave' or activemq_ha_role == 'backup' or amq_broker_replicated %}
<{{ activemq_ha_role }}>
<allow-failback>true</allow-failback>
<allow-failback>{{ activemq_ha_allow_failback | lower }}</allow-failback>
<restart-backup>{{ activemq_ha_restart_backup | lower }}</restart-backup>
{% if activemq_ha_replication_cluster_name | length > 0 %}
<cluster-name>{{ activemq_ha_replication_cluster_name }}</cluster-name>
{% endif %}
{% if activemq_ha_replication_group_name | length > 0 %}
<group-name>{{ activemq_ha_replication_group_name }}</group-name>
{% endif %}
</{{ activemq_ha_role }}>
{% elif activemq_ha_role == 'master' or activemq_ha_role == 'primary' %}
<{{ activemq_ha_role }}>
<check-for-active-server>{{ activemq_ha_check_for_active_server | lower }}</check-for-active-server>
{% if activemq_ha_replication_cluster_name | length > 0 %}
<cluster-name>{{ activemq_ha_replication_cluster_name }}</cluster-name>
{% endif %}
{% if activemq_ha_replication_group_name | length > 0 %}
<group-name>{{ activemq_ha_replication_group_name }}</group-name>
{% endif %}
</{{ activemq_ha_role }}>
{% else %}
<master>
<check-for-live-server>true</check-for-live-server>
</master>
{% endif %}
</replication>
{% endif %}