CI: pip install raus, molecule auf Runner vorinstalliert
Test & Deploy Hugo Docker CMS / test-and-deploy (push) Failing after 2m4s
Test & Deploy Hugo Docker CMS / test-and-deploy (push) Failing after 2m4s
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: Converge
|
||||
ansible.builtin.import_playbook: ../../deploy.yml
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
driver:
|
||||
name: docker
|
||||
|
||||
platforms:
|
||||
- name: ubuntu
|
||||
image: ubuntu:24.04
|
||||
command: /bin/bash -c "while true; do sleep 3600; done"
|
||||
tmpfs:
|
||||
- /tmp
|
||||
- /run
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
inventory:
|
||||
host_vars:
|
||||
ubuntu:
|
||||
target_hostname: "test-node"
|
||||
target_port: 5443
|
||||
deploy_path: "/tmp/.docker/hugo"
|
||||
project_root: "/home/jonnybravo/Projekte/hugo_docker"
|
||||
molecule_test: true
|
||||
config_options:
|
||||
defaults:
|
||||
host_key_checking: false
|
||||
interpreter_python: auto_silent
|
||||
verbosity: 1
|
||||
|
||||
verifier:
|
||||
name: ansible
|
||||
|
||||
scenario:
|
||||
test_sequence:
|
||||
- syntax
|
||||
- create
|
||||
- prepare
|
||||
- converge
|
||||
- idempotence
|
||||
- verify
|
||||
- destroy
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Python und Abhängigkeiten installieren
|
||||
ansible.builtin.raw: |
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq python3 python3-pip sudo rsync
|
||||
changed_when: false
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
- name: Verify
|
||||
hosts: all
|
||||
gather_facts: true
|
||||
vars:
|
||||
deploy_path: "/tmp/.docker/hugo"
|
||||
tasks:
|
||||
- name: Prüfe Verzeichnisstruktur
|
||||
ansible.builtin.stat:
|
||||
path: "{{ deploy_path }}/{{ item }}"
|
||||
loop:
|
||||
- content
|
||||
- crt
|
||||
- site/assets/css/main.css
|
||||
- site/layouts/_default/baseof.html
|
||||
- site/layouts/_default/list.html
|
||||
- site/layouts/_default/rss.xml
|
||||
- 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
|
||||
- docker-compose.yml
|
||||
register: file_check
|
||||
|
||||
- name: Alle Dateien müssen existieren
|
||||
ansible.builtin.assert:
|
||||
that: file_check.results | map(attribute='stat.exists') | list | min
|
||||
fail_msg: "Fehlende Dateien im Deploy-Verzeichnis!"
|
||||
success_msg: "Alle Dateien im Deploy-Verzeichnis 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.executable
|
||||
fail_msg: "entrypoint.sh ist nicht ausführbar!"
|
||||
success_msg: "entrypoint.sh ist ausführbar."
|
||||
|
||||
- name: Prüfe Template-Inhalte
|
||||
ansible.builtin.shell: |
|
||||
grep -q "test-node:5443" {{ deploy_path }}/site/hugo.toml
|
||||
grep -q "test-node:5443" {{ deploy_path }}/Caddyfile
|
||||
register: template_check
|
||||
changed_when: false
|
||||
|
||||
- name: Templates müssen Hostname enthalten
|
||||
ansible.builtin.assert:
|
||||
that: template_check.rc == 0
|
||||
fail_msg: "Templates enthalten nicht den Ziel-Hostnamen!"
|
||||
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