check new version
This commit is contained in:
52
roles/03-installation-minecraft/tasks/04-compile-spigot.yml
Normal file
52
roles/03-installation-minecraft/tasks/04-compile-spigot.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
- name: Check if Spigot is already compiled
|
||||
ansible.builtin.stat:
|
||||
path: "{{ minecraft_sources_dir }}/{{ spigot_jar_name }}"
|
||||
register: spigot_compiled
|
||||
|
||||
- name: Remove old work directory if exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ minecraft_sources_dir }}/work"
|
||||
state: absent
|
||||
when: not spigot_compiled.stat.exists
|
||||
|
||||
- name: Compile Spigot with BuildTools
|
||||
ansible.builtin.shell: |
|
||||
cd {{ minecraft_sources_dir }}
|
||||
java -Xmx1024M -jar {{ buildtools_jar }} --rev {{ minecraft_version }} --compile-if-changed
|
||||
args:
|
||||
creates: "{{ minecraft_sources_dir }}/{{ spigot_jar_name }}"
|
||||
become_user: "{{ minecraft_user }}"
|
||||
when: not spigot_compiled.stat.exists
|
||||
register: compile_result
|
||||
async: 1800
|
||||
poll: 30
|
||||
|
||||
- name: Wait for compilation to complete
|
||||
ansible.builtin.async_status:
|
||||
jid: "{{ compile_result.ansible_job_id }}"
|
||||
register: job_result
|
||||
until: job_result.finished
|
||||
retries: 60
|
||||
delay: 30
|
||||
when: compile_result.ansible_job_id is defined
|
||||
|
||||
- name: Verify Spigot jar was created
|
||||
ansible.builtin.stat:
|
||||
path: "{{ minecraft_sources_dir }}/{{ spigot_jar_name }}"
|
||||
register: spigot_jar_check
|
||||
failed_when: not spigot_jar_check.stat.exists
|
||||
|
||||
- name: Copy compiled Spigot to server directory
|
||||
ansible.builtin.copy:
|
||||
src: "{{ minecraft_sources_dir }}/{{ spigot_jar_name }}"
|
||||
dest: "{{ minecraft_server_dir }}/{{ spigot_jar_name }}"
|
||||
owner: "{{ minecraft_user }}"
|
||||
group: "{{ minecraft_group }}"
|
||||
mode: '0644'
|
||||
remote_src: yes
|
||||
|
||||
- name: Clean up work directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ minecraft_sources_dir }}/work"
|
||||
state: absent
|
Reference in New Issue
Block a user