ansible-roles/lxc-solr/tasks/solr.yml
Jérémy Lecour ee21973371
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2777|524|2253|2462|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/223//ansiblelint">Evolix » ansible-roles » unstable #223</a>
gitea/ansible-roles/pipeline/head This commit looks good
Use FQCN
Fully Qualified Collection Name
2023-03-20 23:33:19 +01:00

45 lines
1.6 KiB
YAML

---
- name: "Set values for Solr < 9.0.0"
ansible.builtin.set_fact:
tarball_url: https://archive.apache.org/dist/lucene/solr/{{ solr_version }}/solr-{{ solr_version }}.tgz
tarball_path: /var/lib/lxc/{{ name }}/rootfs/root/solr-{{ solr_version }}.tgz
start_command: "/etc/init.d/solr start"
stop_command: "/etc/init.d/solr stop"
when: "solr_version is version('9.0.0', '<')"
- name: "Set values for Solr >= 9.0.0"
ansible.builtin.set_fact:
tarball_url: https://archive.apache.org/dist/solr/solr/{{ solr_version }}/solr-{{ solr_version }}.tgz
tarball_path: /var/lib/lxc/{{ name }}/rootfs/root/solr-{{ solr_version }}.tgz
start_command: "systemctl start solr"
stop_command: "systemctl stop solr"
when: "solr_version is version('9.0.0', '>=')"
- name: Install java and lsof packages
ansible.builtin.command:
cmd: "lxc-attach -n {{ name }} -- apt-get install -y default-jre-headless lsof"
- name: "Download Solr {{ solr_version }}"
ansible.builtin.get_url:
url: "{{ tarball_url }}"
dest: "{{ tarball_path }}"
mode: '0644'
- name: "Extract solr-{{ solr_version }}.tgz"
ansible.builtin.unarchive:
src: "{{ tarball_path }}"
dest: /var/lib/lxc/{{ name }}/rootfs/root/
remote_src: yes
- name: "Make sure /home/solr exists"
ansible.builtin.file:
path: /home/solr/{{ name }}
recurse: yes
state: directory
mode: '0755'
- name: "Install Solr {{ solr_version }}"
ansible.builtin.command:
cmd: "lxc-attach -n {{ name }} -- /root/solr-{{ solr_version }}/bin/install_solr_service.sh /root/solr-{{ solr_version }}.tgz -d /home/solr/{{ name }} -p {{ solr_port }}"