83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
---
|
|
# Trillium Notes deployment tasks
|
|
- name: Create Trillium data directory
|
|
file:
|
|
path: "{{ trillium_data_path }}"
|
|
state: directory
|
|
mode: '0755'
|
|
owner: "{{ ansible_user }}"
|
|
group: "{{ ansible_user }}"
|
|
|
|
- name: Create Docker Compose file for Trillium
|
|
template:
|
|
src: docker-compose.yml.j2
|
|
dest: "/opt/trillium/docker-compose.yml"
|
|
mode: '0644'
|
|
owner: "{{ ansible_user }}"
|
|
group: "{{ ansible_user }}"
|
|
|
|
- name: Create Trillium startup script
|
|
template:
|
|
src: start-trillium.sh.j2
|
|
dest: "/opt/trillium/start-trillium.sh"
|
|
mode: '0755'
|
|
owner: "{{ ansible_user }}"
|
|
group: "{{ ansible_user }}"
|
|
|
|
- name: Check if docker-compose is available
|
|
command: docker-compose --version
|
|
register: docker_compose_check
|
|
failed_when: false
|
|
changed_when: false
|
|
when: not ansible_check_mode
|
|
|
|
- name: Stop existing Trillium container if running
|
|
shell: docker-compose -f /opt/trillium/docker-compose.yml down
|
|
args:
|
|
chdir: /opt/trillium
|
|
ignore_errors: yes
|
|
when: not ansible_check_mode and docker_compose_check.rc == 0
|
|
|
|
- name: Start Trillium Notes container
|
|
shell: docker-compose -f /opt/trillium/docker-compose.yml up -d
|
|
args:
|
|
chdir: /opt/trillium
|
|
when: not ansible_check_mode and docker_compose_check.rc == 0
|
|
|
|
- name: Display warning if docker-compose not available
|
|
debug:
|
|
msg: "WARNING: docker-compose not found. Please run with --tags docker first to install Docker and Docker Compose."
|
|
when: not ansible_check_mode and docker_compose_check.rc != 0
|
|
|
|
- name: Wait for Trillium to be ready
|
|
uri:
|
|
url: "http://localhost:{{ trillium_port }}"
|
|
method: GET
|
|
status_code: 200
|
|
register: trillium_ready
|
|
retries: 30
|
|
delay: 10
|
|
until: trillium_ready.status == 200
|
|
when: not ansible_check_mode
|
|
|
|
- name: Display Trillium status
|
|
debug:
|
|
msg: "Trillium Notes is running and accessible on http://localhost:{{ trillium_port }}"
|
|
|
|
- name: Create systemd service for Trillium
|
|
template:
|
|
src: trillium.service.j2
|
|
dest: "/etc/systemd/system/trillium.service"
|
|
mode: '0644'
|
|
|
|
- name: Reload systemd daemon
|
|
systemd:
|
|
daemon_reload: yes
|
|
|
|
- name: Enable Trillium service
|
|
systemd:
|
|
name: trillium
|
|
enabled: yes
|
|
state: started
|
|
when: not ansible_check_mode
|