Git history was lost when the previous Gitea instance was wiped and reinstalled due to an unresolved corruption bug — this commit is the last known-good file content, exported before the reinstall. Prior commit history is not recoverable through this path.
103 lines
2.7 KiB
YAML
103 lines
2.7 KiB
YAML
---
|
|
- name: Install unzip
|
|
ansible.builtin.apt:
|
|
name: unzip
|
|
state: present
|
|
|
|
- name: Copy local osTicket ZIP to remote server
|
|
ansible.builtin.copy:
|
|
src: "{{ playbook_dir }}/osTicket.zip"
|
|
dest: /tmp/osticket.zip
|
|
mode: '0644'
|
|
|
|
- name: Create temp extraction directory
|
|
ansible.builtin.file:
|
|
path: /tmp/osticket_extract
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Extract osTicket ZIP to temp directory
|
|
ansible.builtin.unarchive:
|
|
src: /tmp/osticket.zip
|
|
dest: /tmp/osticket_extract
|
|
remote_src: yes
|
|
|
|
- name: Find upload directory in extracted files
|
|
ansible.builtin.find:
|
|
paths: /tmp/osticket_extract
|
|
patterns: "upload"
|
|
file_type: directory
|
|
register: upload_dir
|
|
|
|
- name: Debug - show found upload directory
|
|
ansible.builtin.debug:
|
|
msg: "Upload directory found at: {{ upload_dir.files[0].path if upload_dir.files else 'NOT FOUND' }}"
|
|
|
|
- name: Copy files to webroot (if upload directory found)
|
|
ansible.builtin.copy:
|
|
src: "{{ upload_dir.files[0].path }}/"
|
|
dest: "/var/www/{{ domain_name }}/"
|
|
remote_src: yes
|
|
owner: www-data
|
|
group: www-data
|
|
mode: '0755'
|
|
when: upload_dir.files
|
|
|
|
- name: Copy all files to webroot (if no upload directory)
|
|
ansible.builtin.copy:
|
|
src: "/tmp/osticket_extract/"
|
|
dest: "/var/www/{{ domain_name }}/"
|
|
remote_src: yes
|
|
owner: www-data
|
|
group: www-data
|
|
mode: '0755'
|
|
when: not upload_dir.files
|
|
|
|
- name: Check if sample config exists
|
|
ansible.builtin.stat:
|
|
path: "/var/www/{{ domain_name }}/include/ost-sampleconfig.php"
|
|
register: sample_config
|
|
|
|
- name: Copy configuration file
|
|
ansible.builtin.copy:
|
|
src: "/var/www/{{ domain_name }}/include/ost-sampleconfig.php"
|
|
dest: "/var/www/{{ domain_name }}/include/ost-config.php"
|
|
owner: www-data
|
|
group: www-data
|
|
mode: '0666'
|
|
remote_src: yes
|
|
when: sample_config.stat.exists
|
|
|
|
- name: Set correct permissions
|
|
ansible.builtin.file:
|
|
path: "/var/www/{{ domain_name }}/include"
|
|
state: directory
|
|
owner: www-data
|
|
group: www-data
|
|
mode: '0755'
|
|
recurse: yes
|
|
|
|
- name: Create attachment directory
|
|
ansible.builtin.file:
|
|
path: "/var/www/{{ domain_name }}/attachments"
|
|
state: directory
|
|
owner: www-data
|
|
group: www-data
|
|
mode: '0777'
|
|
|
|
- name: Clean up temp files
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: absent
|
|
loop:
|
|
- /tmp/osticket.zip
|
|
- /tmp/osticket_extract
|
|
|
|
- name: Display completion message
|
|
ansible.builtin.debug:
|
|
msg:
|
|
- "✅ osTicket successfully installed!"
|
|
- "📍 Access web installer at: http://{{ domain_name }}/"
|
|
- "⚠️ Complete setup via browser"
|
|
- "🔒 After installation, run: chmod 0644 /var/www/{{ domain_name }}/include/ost-config.php"
|