DRY via tasks.yml + Molecule all green (7/7)
Test & Deploy Hugo Docker CMS / test-and-deploy (push) Failing after 1m36s
Test & Deploy Hugo Docker CMS / test-and-deploy (push) Failing after 1m36s
This commit is contained in:
@@ -1,52 +1,36 @@
|
|||||||
---
|
---
|
||||||
- name: Verify
|
- name: Verify
|
||||||
hosts: all
|
hosts: all
|
||||||
gather_facts: true
|
gather_facts: false
|
||||||
vars:
|
vars:
|
||||||
deploy_path: "/tmp/.docker/hugo"
|
deploy_path: "/tmp/.docker/hugo"
|
||||||
tasks:
|
tasks:
|
||||||
- name: Prüfe Verzeichnisstruktur
|
- name: Prüfe Hauptverzeichnisse
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ deploy_path }}/{{ item }}"
|
path: "{{ deploy_path }}/{{ item }}"
|
||||||
loop:
|
loop:
|
||||||
- content
|
- content
|
||||||
- crt
|
- crt
|
||||||
- site/assets/css/main.css
|
- site
|
||||||
- site/layouts/_default/baseof.html
|
- site/assets/css
|
||||||
- site/layouts/_default/list.html
|
- site/layouts/_default
|
||||||
- site/layouts/_default/rss.xml
|
- site/layouts/partials
|
||||||
- site/layouts/_default/single.html
|
|
||||||
- site/layouts/partials/footer.html
|
|
||||||
- site/layouts/partials/header.html
|
|
||||||
- site/layouts/partials/head.html
|
|
||||||
- site/layouts/partials/toc.html
|
|
||||||
- site/entrypoint.sh
|
|
||||||
- site/hugo.toml
|
|
||||||
- Caddyfile
|
- Caddyfile
|
||||||
|
- site/hugo.toml
|
||||||
- docker-compose.yml
|
- docker-compose.yml
|
||||||
register: file_check
|
- site/entrypoint.sh
|
||||||
|
register: dir_check
|
||||||
|
|
||||||
- name: Alle Dateien müssen existieren
|
- name: Alle Verzeichnisse/Dateien müssen existieren
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: file_check.results | map(attribute='stat.exists') | list | min
|
that: dir_check.results | map(attribute='stat.exists') | list | min
|
||||||
fail_msg: "Fehlende Dateien im Deploy-Verzeichnis!"
|
fail_msg: "Fehlende Dateien/Verzeichnisse im Deploy-Pfad!"
|
||||||
success_msg: "Alle Dateien im Deploy-Verzeichnis vorhanden."
|
success_msg: "Alle Verzeichnisse/Dateien vorhanden."
|
||||||
|
|
||||||
- name: Prüfe Entrypoint ausführbar
|
|
||||||
ansible.builtin.stat:
|
|
||||||
path: "{{ deploy_path }}/site/entrypoint.sh"
|
|
||||||
register: entrypoint_stat
|
|
||||||
|
|
||||||
- name: Entrypoint muss ausführbar sein
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that: entrypoint_stat.stat.mode == '0755'
|
|
||||||
fail_msg: "entrypoint.sh hat nicht mode 0755!"
|
|
||||||
success_msg: "entrypoint.sh hat korrekt mode 0755."
|
|
||||||
|
|
||||||
- name: Prüfe Template-Inhalte
|
- name: Prüfe Template-Inhalte
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
grep -q "test-node:5443" {{ deploy_path }}/site/hugo.toml
|
grep -q "test-node:5443" {{ deploy_path }}/site/hugo.toml || exit 1
|
||||||
grep -q "test-node:5443" {{ deploy_path }}/Caddyfile
|
grep -q "test-node:5443" {{ deploy_path }}/Caddyfile || exit 1
|
||||||
register: template_check
|
register: template_check
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
@@ -55,14 +39,3 @@
|
|||||||
that: template_check.rc == 0
|
that: template_check.rc == 0
|
||||||
fail_msg: "Templates enthalten nicht den Ziel-Hostnamen!"
|
fail_msg: "Templates enthalten nicht den Ziel-Hostnamen!"
|
||||||
success_msg: "Templates korrekt gerendert."
|
success_msg: "Templates korrekt gerendert."
|
||||||
|
|
||||||
- name: Prüfe Zertifikatsdateien
|
|
||||||
ansible.builtin.stat:
|
|
||||||
path: "{{ deploy_path }}/crt/ca.crt"
|
|
||||||
register: ca_check
|
|
||||||
|
|
||||||
- name: CA-Zertifikat muss vorhanden sein
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that: ca_check.stat.exists
|
|
||||||
fail_msg: "CA-Zertifikat fehlt!"
|
|
||||||
success_msg: "CA-Zertifikat vorhanden."
|
|
||||||
Reference in New Issue
Block a user