ansible-role-lstu/tasks/lstu.yml

101 lines
2.7 KiB
YAML
Raw Normal View History

2022-12-10 15:02:35 +01:00
- name: "lstu | Ermittle aktuellen Tag"
ansible.builtin.shell:
cmd: curl -s "{{ lstu_api_url }}" | jq '.[]' | jq -r '.name' | head -1
changed_when: false
register: latest_tag
- name: "lstu | Erstelle Verzeichnisse"
ansible.builtin.file:
path: "{{ lstu.path }}"
state: directory
owner: "{{ lstu_user }}"
2022-12-14 17:17:59 +01:00
group: "{{ lstu_user }}"
2022-12-10 15:02:35 +01:00
mode: 0755
recurse: true
- name: "lstu | Klone Git"
ansible.builtin.git:
repo: "{{ lstu_git_url }}"
dest: "{{ lstu.path }}"
force: true
version: "{{ latest_tag.stdout }}"
- name: "lstu | Kopiere Konfiguration"
ansible.builtin.copy:
src: "{{ lstu.path }}/lstu.conf.template"
dest: "{{ lstu.path }}/lstu.conf"
mode: 0640
remote_src: true
force: false
register: configuration
- name: "lstu | Installiere Abhängigkeiten"
ansible.builtin.shell:
#cmd: carton install --deployment --without=test --without=sqlite --without=postgresql --without=ldap --without=htpasswd --without=cache
cmd: carton install --without=test --without=sqlite --without=postgresql --without=ldap --without=htpasswd --without=cache
chdir: "{{ lstu.path }}"
when: configuration.changed
2022-12-20 20:28:09 +01:00
- name: "lstu | Kopiere Konfiguration"
ansible.builtin.template:
src: lstu.conf
dest: "{{ lstu.path }}"
mode: 0640
owner: "{{ lstu_user }}"
group: "{{ lstu_user }}"
notify: restart lstu
2022-12-10 15:02:35 +01:00
- name: "lstu | set ownership"
ansible.builtin.file:
path: "{{ lstu.path }}"
owner: "{{ lstu_user }}"
group: "{{ lstu_user }}"
recurse: true
- name: "lstu | Kopiere systemd-Unit"
ansible.builtin.template:
src: lstu.service.j2
dest: "/etc/systemd/system/{{ lstu_service }}"
mode: 0644
notify: restart lstu
2022-12-14 17:17:59 +01:00
- name: "lstu | Kopiere systemd-Unit für minion-Worker"
ansible.builtin.template:
src: lstu-minion.service
dest: "/etc/systemd/system/{{ minion_service }}@.service"
mode: 0644
- name: lstu | Starte minion-Worker
ansible.builtin.systemd:
name: "{{ minion_service }}@{{ item }}"
enabled: true
state: restarted
daemon_reload: true
loop: "{{ range(0, minion_workers ) | list }}"
2022-12-10 15:02:35 +01:00
- name: "lstu | Prüfe Theme-Verzeichnis"
ansible.builtin.stat:
path: "{{ lstu.path }}/themes/{{ lstu_theme }}"
register: theme
# - name: "lstu | Kopiere Update-Skript"
# ansible.builtin.template:
# src: lstu-updater.j2
# dest: "/usr/local/bin/lstu-updater"
# mode: 0755
# - name: "lstu | Cron für Auto-Updates"
# ansible.builtin.cron:
# name: lstu Aktualisierungen
# hour: "3"
# minute: "3"
# job: "chronic /usr/local/bin/lstu-updater"
- name: "lstu | Monit-Überwachung"
ansible.builtin.template:
src: monit.j2
2022-12-13 13:00:38 +01:00
dest: /etc/monit/conf-enabled/lstu
2022-12-10 15:02:35 +01:00
mode: 0644
notify: reload monit