ansible-role-lstu/tasks/lstu.yml
phil 9fc151cb1e lstu: Entferne warn-Definition
Wird in neuere Ansible-Versionen nicht mehr unterstützt
2023-01-15 12:11:56 +01:00

101 lines
2.7 KiB
YAML

- 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 }}"
group: "{{ lstu_user }}"
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
- name: "lstu | Kopiere Konfiguration"
ansible.builtin.template:
src: lstu.conf
dest: "{{ lstu.path }}"
mode: 0640
owner: "{{ lstu_user }}"
group: "{{ lstu_user }}"
notify: restart lstu
- 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
- 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 }}"
- 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
dest: /etc/monit/conf-enabled/lstu
mode: 0644
notify: reload monit