forked from ISTI-ansible-roles/ansible-roles
81 lines
3.1 KiB
YAML
81 lines
3.1 KiB
YAML
---
|
|
- name: Create the exist-db user and the directory tree
|
|
block:
|
|
- name: Create the exist-db user
|
|
user: name={{ exist_db_user }} home={{ exist_db_home }} comment="eXist-db Service Account" createhome=no shell=/usr/sbin/nologin system=yes
|
|
|
|
- name: Create the exist-db base path
|
|
file: dest={{ item }} state=directory mode=0750 owner=root group={{ exist_db_group }}
|
|
with_items:
|
|
- '{{ exist_db_home }}'
|
|
- '{{ exist_db_home }}/distribution'
|
|
- '{{ exist_db_conf_dir }}'
|
|
|
|
- name: Create the exist-db directory tree
|
|
file: dest={{ item }} state=directory mode=0750 owner={{ exist_db_user }} group={{ exist_db_group }}
|
|
with_items:
|
|
- '{{ exist_db_data_dir }}'
|
|
- '{{ exist_db_journal_dir }}'
|
|
- '{{ exist_db_backup_dir }}'
|
|
- '{{ exist_db_logdir }}'
|
|
|
|
- name: Link the log and data directories from the exist distribution directory
|
|
file: dest={{ exist_db_home }}/distribution/{{ exist_db_distribution_dir }}/{{ item }} state=absent
|
|
with_items:
|
|
- 'data'
|
|
- 'logs'
|
|
|
|
- name: Link the log directory into the exist distribution directory
|
|
file: src={{ exist_db_logdir }} dest={{ exist_db_home }}/distribution/{{ exist_db_distribution_dir }}/logs state=link
|
|
|
|
- name: Link the data directory into the exist distribution directory
|
|
file: src={{ exist_db_data_dir }} dest={{ exist_db_home }}/distribution/{{ exist_db_distribution_dir }}/data state=link
|
|
|
|
tags: [ 'exist-db', 'exist_db' ]
|
|
|
|
- name: Download and unpack the eXist DB distribution
|
|
block:
|
|
- name: Download the eXist DB archive
|
|
get_url: url={{ exist_db_distribution }} dest=/srv/exist-distribution-{{ exist_db_version }}-unix.tar.bz2
|
|
|
|
- name: Unarchive the eXist DB distribution
|
|
unarchive: src=/srv/exist-distribution-{{ exist_db_version }}-unix.tar.bz2 dest={{ exist_db_home }}/distribution remote_src=yes owner=root group=root
|
|
args:
|
|
creates: '{{ exist_db_home }}/distribution/{{ exist_db_distribution_dir }}/lib'
|
|
|
|
tags: [ 'exist-db', 'exist_db' ]
|
|
|
|
- name: Configure the eXistDB service
|
|
block:
|
|
- name: Install the changes to the configuration files in the custom etc/ directory
|
|
template: src={{ item }}.j2 dest={{ exist_db_conf_dir }}/{{ item }}
|
|
with_items:
|
|
- 'conf.xml'
|
|
- 'log4j2.xml'
|
|
notify: Restart existdb
|
|
|
|
- name: Install the startup scripts
|
|
template: src={{ item }}.j2 dest={{ exist_db_home }}/distribution/{{ exist_db_distribution_dir }}/bin/{{ item }} owner=root group=root mode=0755
|
|
with_items:
|
|
- 'startup.sh'
|
|
- 'shutdown.sh'
|
|
- 'backup.sh'
|
|
- 'client.sh'
|
|
- 'export.sh'
|
|
|
|
- name: Install the exist-db systemd unit
|
|
template: src=exist-db.service.j2 dest=/lib/systemd/system/exist-db.service owner=root group=root mode=0644
|
|
register: existdb_unit_install
|
|
|
|
- name: Reload the systemd configuration
|
|
systemd: daemon_reload=yes
|
|
when: existdb_unit_install is changed
|
|
|
|
- name: Ensure that the eXistDB service is running and enabled
|
|
service: name=exist-db state=started enabled=yes
|
|
|
|
tags: [ 'exist-db', 'exist_db', 'exist_db_conf' ]
|
|
|
|
|
|
|
|
|