Files
appconsumption-demo-app/ansible-semaphore-docker-demo/README.md

1.6 KiB

SemaphoreUI Docker Splash Demo

Demo Ansible molto semplice, pensata per essere eseguita da SemaphoreUI:

  • test.yml: verifica connettivita e prerequisiti
  • deploy.yml: deploy di un container Nginx Docker con pagina HTML custom
  • undeploy.yml: rimozione container e cleanup

Struttura

ansible-semaphore-docker-demo/
  ansible.cfg
  inventory
  requirements.yml
  deploy.yml
  test.yml
  undeploy.yml
  group_vars/
    all.yml
    secrets.yml
  roles/
    splash/
      tasks/main.yml
      templates/index.html.j2
      templates/nginx.conf.j2
  semaphore_dagster_config.example.yml

Prerequisiti host target

  • Linux con accesso SSH
  • Privilegi sudo/root
  • Debian/Ubuntu (nel playbook installo docker.io e python3-docker)

Uso locale rapido

cd ansible-semaphore-docker-demo
ansible-galaxy collection install -r requirements.yml
ansible-playbook -i inventory test.yml
ansible-playbook -i inventory deploy.yml
ansible-playbook -i inventory undeploy.yml

Accesso app

Dopo il deploy:

  • http://<IP_SERVER>:8090
  • healthcheck: http://<IP_SERVER>:8090/health

Variabili principali

In group_vars/all.yml:

  • app_port
  • greeting_message
  • container_name
  • nginx_version
  • accent_color
  • secondary_color

In group_vars/secrets.yml:

  • app_secret
  • release_id

Per produzione: cifra group_vars/secrets.yml con Ansible Vault.

SemaphoreUI

Per bootstrap automatico con il tuo DAG, usa il file:

  • semaphore_dagster_config.example.yml

Basta aggiornare URL Semaphore, token API, project ID, repo URL e inventory content.