Skip to content

Commit

Permalink
Get rid of separate role which is unusable with the current structure
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Nov 26, 2024
1 parent 186d6a7 commit 587c44c
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 330 deletions.
1 change: 0 additions & 1 deletion .github/workflows/community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
- name: search
- name: tomcat
- name: transformers
- name: systemd_service
env:
PY_COLORS: 1
PYTHONUNBUFFERED: 1
Expand Down
13 changes: 13 additions & 0 deletions roles/audit_storage/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,16 @@ audit_storage_java_bin_path: /opt/openjdk-17.0.11/bin/java

audit_storage_binaries_dir: "/opt/alfresco/audit-storage-{{ audit_storage_version }}"
audit_storage_config_dir: "/etc/alfresco/audit-storage"

audit_storage_systemd_service_unit_name: "alfresco-audit-storage"
audit_storage_systemd_service_unit_description: "Alfresco Audit Storage"
audit_storage_systemd_service_exec_start: "{{ audit_storage_java_bin_path }} -jar {{ audit_storage_artifact_path }}"
audit_storage_systemd_service_user: "{{ audit_storage_username }}"

audit_storage_systemd_service_unit_after: syslog.target network.target local-fs.target remote-fs.target nss-lookup.target
audit_storage_systemd_service_type: simple
audit_storage_systemd_service_exec_stop: kill -15 $MAINPID
audit_storage_systemd_service_working_directory: /tmp
audit_storage_systemd_service_additional_options: {}
audit_storage_systemd_service_state: started
audit_storage_systemd_service_enabled: true
9 changes: 9 additions & 0 deletions roles/audit_storage/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
---
# handlers file for audit_storage
- name: Reload systemd
ansible.builtin.systemd:
daemon_reload: true

- name: Restart {{ audit_storage_systemd_service_unit_name }}
ansible.builtin.systemd:
name: "{{ audit_storage_systemd_service_unit_name }}"
state: restarted
when: audit_storage_systemd_service_state == 'started'
25 changes: 14 additions & 11 deletions roles/audit_storage/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@
owner: "{{ audit_storage_username }}"
group: "{{ audit_storage_group_name }}"

- name: Install service
ansible.builtin.include_role:
name: systemd_service
vars:
systemd_service_unit_name: "alfresco-audit-storage"
systemd_service_unit_description: "Alfresco Audit Storage"
systemd_service_exec_start: "{{ audit_storage_java_bin_path }} -jar {{ audit_storage_artifact_path }}"
systemd_service_user: "{{ audit_storage_username }}"
systemd_service_environment: >-
{{ audit_storage_default_environment |
combine(audit_storage_environment) }}
- name: Create systemd service
ansible.builtin.template:
src: systemd-service.j2
dest: /etc/systemd/system/{{ audit_storage_systemd_service_unit_name }}.service
mode: "0644"
notify:
- Reload systemd
- Restart {{ audit_storage_systemd_service_unit_name }}

- name: Start service
ansible.builtin.systemd:
name: "{{ audit_storage_systemd_service_unit_name }}"
state: "{{ audit_storage_systemd_service_state }}"
enabled: "{{ audit_storage_systemd_service_enabled }}"
31 changes: 31 additions & 0 deletions roles/audit_storage/templates/systemd-service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[Unit]
Description={{ audit_storage_systemd_service_unit_description }}
After={{ audit_storage_systemd_service_unit_after }}

[Service]
Type={{ audit_storage_systemd_service_type }}
{% if audit_storage_systemd_service_type == 'oneshot' %}
RemainAfterExit=yes
{% endif %}

User={{ audit_storage_systemd_service_user }}

{% for key, value in audit_storage_systemd_service_environment.items() %}
Environment="{{ key }}={{ value | replace('%', '%%') }}"
{% endfor %}

ExecStart={{ audit_storage_systemd_service_exec_start }}
ExecStop={{ audit_storage_systemd_service_exec_stop }}

Restart=on-failure
RestartSec=60
SuccessExitStatus=143

WorkingDirectory={{ audit_storage_systemd_service_working_directory }}

{% for key, value in audit_storage_systemd_service_additional_options.items() %}
{{ key }}={{ value }}
{% endfor %}

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions roles/audit_storage/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
# vars file for audit_storage
audit_storage_artifact_path: "{{ audit_storage_binaries_dir }}/{{ audit_storage_artifact_name }}-{{ audit_storage_version }}.jar"
audit_storage_systemd_service_environment: >-
{{ audit_storage_default_environment |
combine(audit_storage_environment) }}
118 changes: 0 additions & 118 deletions roles/systemd_service/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions roles/systemd_service/defaults/main.yml

This file was deleted.

11 changes: 0 additions & 11 deletions roles/systemd_service/handlers/main.yml

This file was deleted.

54 changes: 0 additions & 54 deletions roles/systemd_service/meta/argument_specs.yml

This file was deleted.

15 changes: 0 additions & 15 deletions roles/systemd_service/meta/main.yml

This file was deleted.

15 changes: 0 additions & 15 deletions roles/systemd_service/molecule/default/converge.yml

This file was deleted.

15 changes: 0 additions & 15 deletions roles/systemd_service/molecule/default/molecule.yml

This file was deleted.

26 changes: 0 additions & 26 deletions roles/systemd_service/molecule/default/verify.yml

This file was deleted.

16 changes: 0 additions & 16 deletions roles/systemd_service/tasks/main.yml

This file was deleted.

Loading

0 comments on commit 587c44c

Please sign in to comment.