-
Notifications
You must be signed in to change notification settings - Fork 12
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
New activemq_uninstall role #150
Merged
guidograzioli
merged 6 commits into
ansible-middleware:main
from
guidograzioli:uninstall_role
Aug 19, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
403ebfd
Add new role activemq_uninstall
guidograzioli 4edba6d
Add uninstall test scenario
guidograzioli 05ff52c
Bump minor
guidograzioli 97feff1
linter
guidograzioli 12e8da3
add test scenario to CI
guidograzioli 2a4e065
fix typo in parameter
guidograzioli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
namespace: middleware_automation | ||
name: amq | ||
version: "2.1.2" | ||
version: "2.2.0" | ||
readme: README.md | ||
authors: | ||
- Guido Grazioli <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
gather_facts: yes | ||
vars: | ||
activemq_service_user_home: /home/activemq | ||
roles: | ||
- middleware_automation.amq.activemq_uninstall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
driver: | ||
name: docker | ||
platforms: | ||
- name: instance | ||
image: registry.access.redhat.com/ubi9/ubi-init:latest | ||
pre_build_image: true | ||
privileged: true | ||
command: "/usr/sbin/init" | ||
tmpfs: | ||
- /run | ||
- /tmp | ||
port_bindings: | ||
- 8161:8161 | ||
published_ports: | ||
- 0.0.0.0:8161:8161/TCP | ||
provisioner: | ||
name: ansible | ||
config_options: | ||
defaults: | ||
interpreter_python: auto_silent | ||
ssh_connection: | ||
pipelining: false | ||
playbooks: | ||
prepare: prepare.yml | ||
converge: converge.yml | ||
verify: verify.yml | ||
inventory: | ||
host_vars: | ||
localhost: | ||
ansible_python_interpreter: "{{ ansible_playbook_python }}" | ||
env: | ||
ANSIBLE_FORCE_COLOR: "true" | ||
verifier: | ||
name: ansible | ||
scenario: | ||
test_sequence: | ||
- cleanup | ||
- destroy | ||
- create | ||
- prepare | ||
- converge | ||
- idempotence | ||
- side_effect | ||
- verify | ||
- cleanup | ||
- destroy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
- name: Prepare | ||
hosts: all | ||
tasks: | ||
- name: "Run preparation common to all scenario" | ||
ansible.builtin.include_tasks: ../prepare.yml | ||
|
||
- name: Install | ||
hosts: all | ||
gather_facts: yes | ||
vars: | ||
activemq_service_user_home: /home/activemq | ||
activemq_hawtio_role: admin | ||
activemq_users: | ||
- user: amq | ||
password: amqbrokerpass | ||
roles: [ admin ] | ||
- user: other | ||
password: amqotherpass | ||
roles: [ consumer, producer ] | ||
activemq_roles: | ||
- name: admin | ||
permissions: [ createNonDurableQueue, deleteNonDurableQueue, createDurableQueue, deleteDurableQueue, createAddress, deleteAddress, consume, browse, send, manage ] | ||
- name: manager | ||
permissions: [ browse, manage ] | ||
- name: topicsmanager | ||
match: topics.# | ||
permissions: [ createNonDurableQueue, deleteNonDurableQueue, createDurableQueue, deleteDurableQueue, browse, manage ] | ||
- name: consumer | ||
match: topics.# | ||
permissions: [ consume, browse ] | ||
- name: producer | ||
match: topics.# | ||
permissions: [ send, browse ] | ||
activemq_acceptors: | ||
- name: artemis | ||
bind_address: "{{ activemq_host }}" | ||
bind_port: "{{ activemq_port }}" | ||
parameters: | ||
tcpSendBufferSize: 1048576 | ||
tcpReceiveBufferSize: 1048576 | ||
protocols: CORE,MQTT | ||
useEpoll: true | ||
- name: amqp | ||
scheme: tcp | ||
bind_address: "{{ activemq_host }}" | ||
bind_port: "{{ activemq_port_amqp }}" | ||
parameters: | ||
tcpSendBufferSize: 1048576 | ||
tcpReceiveBufferSize: 1048576 | ||
protocols: AMQP | ||
useEpoll: true | ||
amqpMinLargeMessageSize: 102400 | ||
amqpCredits: 1000 | ||
amqpLowCredits: 300 | ||
amqpDuplicateDetection: true | ||
- name: invm | ||
scheme: vm | ||
activemq_diverts: | ||
- name: TESTDIVERT | ||
address: queue.in | ||
forwarding_address: queue.out | ||
routing_type: ANYCAST | ||
filter: "msgType LIKE '%ff%'" | ||
exclusive: True | ||
roles: | ||
- middleware_automation.amq.activemq | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../roles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
become: yes | ||
tasks: | ||
- name: Populate service facts | ||
ansible.builtin.service_facts: | ||
|
||
- name: Check if amq-broker service is started | ||
ansible.builtin.assert: | ||
that: | ||
- '"amq-broker.service" not in ansible_facts.services' | ||
|
||
- name: Check install dir | ||
ansible.builtin.stat: | ||
path: /opt/amq/amq-broker/ | ||
register: broker_bin | ||
|
||
- name: Check install dir | ||
ansible.builtin.stat: | ||
path: /opt/amq/ | ||
register: broker_artemis | ||
|
||
- name: Check user homedir | ||
ansible.builtin.stat: | ||
path: /home/activemq | ||
register: broker_user | ||
|
||
- name: Verify uninstall | ||
ansible.builtin.assert: | ||
that: | ||
- not broker_user.stat.exists or activemq_uninstall_skip_user | ||
- not broker_artemis.stat.exists or activemq_uninstall_skip_artemis | ||
- not broker_bin.stat.exists | ||
quiet: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
activemq_uninstall | ||
================== | ||
|
||
Uninstalls an activemq service that was installed by the activemq role. | ||
|
||
|
||
Dependencies | ||
------------ | ||
|
||
The role depends on the following collections: | ||
|
||
* [middleware_automation.common](https://github.com/ansible-middleware/common) | ||
* [ansible.posix](https://github.com/ansible-collections/ansible.posix) | ||
|
||
To install, from the collection root directory, run: | ||
|
||
ansible-galaxy collections install -r requirements.yml | ||
|
||
|
||
<!--start argument_specs--> | ||
Role Defaults | ||
------------- | ||
|
||
#### Parameters specific to uninstall role | ||
|
||
| Variable | Description | Default | | ||
|:---------|:------------|:--------| | ||
|`activemq_uninstall_skip_user`| Whether to skip user/group account deletion | `false` | | ||
|`activemq_uninstall_skip_zipfile`| Whether to skip installation zipfile deletion | `false` | | ||
|`activemq_uninstall_skip_artemis`| Whether to skip artemis directory deletion | `false` | | ||
|
||
|
||
#### Parameters as used with activemq role | ||
|
||
| Variable | Description | Default | | ||
|:---------|:------------|:--------| | ||
|`activemq_version`| Apache Artemis version | `2.34.0` | | ||
|`activemq_archive`| Apache Artemis install archive filename | `apache-artemis-{{ activemq_version }}-bin.zip` | | ||
|`activemq_installdir`| Apache Artemis Installation path | `{{ activemq_dest }}/apache-artemis-{{ activemq_version }}` | | ||
|`activemq_dest`| Root installation directory | `/opt/amq` | | ||
|`activemq_service_user`| POSIX user running the service | `amq-broker` | | ||
|`activemq_service_group`| POSIX group running the service | `amq-broker` | | ||
|`activemq_service_name`| systemd service unit name | `activemq` | | ||
|`activemq_service_user_home`| Service user home directory, defaults to artemis installation directory | `{{ activemq_dest }}/apache-artemis-{{ activemq_version }}` | | ||
|`activemq_instance_name`| Name of broker instance to deploy | `amq-broker` | | ||
|`activemq_configure_firewalld`| Whether to install and configure firewalld | `False` | | ||
|`activemq_shared_storage`| Use shared filesystem directory for storage | `False` | | ||
|`activemq_shared_storage_path`| Absolute path of shared directory | `{{ activemq_dest }}/{{ activemq_instance_name }}/data/shared` | | ||
|`activemq_shared_storage_mounted`| Whether the systemd unit must require a mounted path (only when using shared storage) | `True` | | ||
|
||
|
||
Example Playbook | ||
---------------- | ||
``` | ||
--- | ||
- hosts: all | ||
roles: | ||
- middleware_automation.amq.activemq_uninstall | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same remark on the role inclusion syntax. |
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
### Parameters as used with activemq role | ||
activemq_version: 2.34.0 | ||
activemq_archive: "apache-artemis-{{ activemq_version }}-bin.zip" | ||
activemq_installdir: "{{ activemq_dest }}/apache-artemis-{{ activemq_version }}" | ||
activemq_dest: /opt/amq | ||
activemq_service_user: amq-broker | ||
activemq_service_group: amq-broker | ||
activemq_service_user_home: "{{ activemq_dest }}/apache-artemis-{{ activemq_version }}" | ||
activemq_instance_name: amq-broker | ||
activemq_service_pidfile: data/artemis.pid | ||
activemq_configure_firewalld: false | ||
activemq_name: 'Apache ActiveMQ' | ||
activemq_service_name: activemq | ||
activemq_data_directory: "{{ activemq_shared_storage_path if activemq_shared_storage else activemq_dest + '/' + activemq_instance_name + '/data' }}" | ||
activemq_paging_directory: "{{ activemq_data_directory }}/paging" | ||
activemq_bindings_directory: "{{ activemq_data_directory }}/bindings" | ||
activemq_journal_directory: "{{ activemq_data_directory }}/journal" | ||
activemq_large_messages_directory: "{{ activemq_data_directory }}/largemessages" | ||
activemq_shared_storage: false | ||
activemq_shared_storage_mounted: true | ||
activemq_shared_storage_path: "{{ activemq_dest }}/{{ activemq_instance_name }}/data/shared" | ||
|
||
### Parameters specific to uninstall role | ||
# skip user/group deletion | ||
activemq_uninstall_skip_user: false | ||
# skip install zipfile deletion | ||
activemq_uninstall_skip_zipfile: false | ||
# skip artemis install deletion | ||
activemq_uninstall_skip_artemis: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
argument_specs: | ||
main: | ||
options: | ||
activemq_version: | ||
default: "2.34.0" | ||
description: "Apache Artemis version" | ||
type: "str" | ||
activemq_archive: | ||
default: "apache-artemis-{{ activemq_version }}-bin.zip" | ||
description: "Apache Artemis install archive filename" | ||
type: "str" | ||
activemq_installdir: | ||
default: "{{ activemq_dest }}/apache-artemis-{{ activemq_version }}" | ||
description: "Apache Artemis Installation path" | ||
type: "str" | ||
activemq_service_user_home: | ||
default: "{{ activemq_dest }}/apache-artemis-{{ activemq_version }}" | ||
description: "Service user home directory, defaults to artemis installation directory" | ||
type: "str" | ||
activemq_dest: | ||
default: "/opt/activemq" | ||
description: "Root installation directory" | ||
type: "str" | ||
activemq_service_user: | ||
default: "amq-broker" | ||
description: "POSIX user running the service" | ||
type: "str" | ||
activemq_service_group: | ||
default: "amq-broker" | ||
description: "POSIX group running the service" | ||
type: "str" | ||
activemq_instance_name: | ||
default: "amq-broker" | ||
description: "Name of broker instance to deploy" | ||
type: "str" | ||
activemq_service_pidfile: | ||
default: "data/artemis.pid" | ||
description: "PID file for service" | ||
type: "str" | ||
activemq_configure_firewalld: | ||
default: false | ||
description: "Whether to install and configure firewalld" | ||
type: "bool" | ||
activemq_shared_storage: | ||
default: false | ||
description: "Use shared filesystem directory for storage" | ||
type: "bool" | ||
activemq_shared_storage_path: | ||
default: "{{ activemq_dest }}/{{ activemq_instance_name }}/data/shared" | ||
description: "Absolute path of shared directory" | ||
type: "str" | ||
activemq_shared_storage_mounted: | ||
default: true | ||
description: "Whether the systemd unit must require a mounted path (only when using shared storage)" | ||
type: "bool" | ||
activemq_name: | ||
description: 'Human friendly name for service' | ||
default: "Apache ActiveMQ" | ||
type: "str" | ||
activemq_service_name: | ||
description: "Systemd unit name" | ||
default: "activemq" | ||
type: "str" | ||
activemq_paging_directory: | ||
description: 'The directory to store paged messages in' | ||
default: 'data/paging' | ||
type: "str" | ||
activemq_bindings_directory: | ||
description: 'The folder in use for the bindings folder' | ||
default: 'data/bindings' | ||
type: "str" | ||
activemq_journal_directory: | ||
description: 'The directory to store the journal files in' | ||
default: 'data/journal' | ||
type: "str" | ||
activemq_large_messages_directory: | ||
description: 'The directory to store large messages' | ||
default: 'data/largemessages' | ||
type: "str" | ||
activemq_journal_datasync: | ||
description: 'Whether to use msync/fsync on journal operations' | ||
default: true | ||
type: 'bool' | ||
activemq_data_directory: | ||
description: "The activemq data directory path" | ||
default: "{{ activemq_shared_storage_path if activemq_shared_storage else activemq_dest + '/' + activemq_instance_name + '/data' }}" | ||
type: 'str' | ||
activemq_uninstall_skip_user: | ||
description: 'Whether to skip user/group account deletion' | ||
default: false | ||
type: 'bool' | ||
activemq_uninstall_skip_zipfile: | ||
description: 'Whether to skip installation zipfile deletion' | ||
default: false | ||
type: 'bool' | ||
activemq_uninstall_skip_artemis: | ||
description: 'Whether to skip artemis directory deletion' | ||
default: false | ||
type: 'bool' | ||
downstream: | ||
options: | ||
amq_broker_version: | ||
default: "7.12.0" | ||
description: "Red Hat AMQ Broker version" | ||
type: "str" | ||
amq_broker_enable: | ||
default: true | ||
description: "Enable installation of Red Hat AMQ Broker" | ||
type: "bool" | ||
amq_broker_archive: | ||
default: "amq-broker-{{ amq_broker_version }}-bin.zip" | ||
description: "Red Hat AMQ Broker install archive filename" | ||
type: "str" | ||
amq_broker_installdir: | ||
default: "{{ amq_broker_dest }}/amq-broker-{{ amq_broker_version }}" | ||
description: "Red Hat AMQ Broker installation path" | ||
type: "str" | ||
amq_broker_dest: | ||
default: "/opt/amq" | ||
description: "Root installation directory" | ||
type: "str" | ||
amq_broker_name: | ||
description: "Human friendly name for service" | ||
default: "Red Hat AMQ Broker" | ||
type: "str" | ||
amq_broker_service_name: | ||
description: "Systemd unit name" | ||
default: "amq_broker" | ||
type: "str" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not the new "good" syntax like that:
?