From 6e072176260710880c0b5ad8b3b45e03aab140df Mon Sep 17 00:00:00 2001 From: Lenoctambule <106790775+lenoctambule@users.noreply.github.com> Date: Mon, 6 Apr 2026 16:04:46 +0200 Subject: [PATCH] fix: url issues + setup for eval --- clear.yml | 6 ++++++ files/inception/srcs/docker-compose.yml | 26 +++++++++++++++++++++++-- inventory/remote.yml | 5 +++++ templates/.env.j2 | 2 +- vars.yml | 3 +-- 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 inventory/remote.yml diff --git a/clear.yml b/clear.yml index e6d7222..bddddea 100644 --- a/clear.yml +++ b/clear.yml @@ -14,3 +14,9 @@ ansible.builtin.file: state: absent path: "{{ dest_dir }}" + + - name: Remove schedule to start app at reboot + ansible.builtin.cron: + name: "Start app at boot" + special_time: reboot + state: absent \ No newline at end of file diff --git a/files/inception/srcs/docker-compose.yml b/files/inception/srcs/docker-compose.yml index e96bf20..8b890b3 100644 --- a/files/inception/srcs/docker-compose.yml +++ b/files/inception/srcs/docker-compose.yml @@ -83,10 +83,32 @@ services: - site_data:/var/www/html depends_on: - wordpress + - mariadb working_dir: /var/www/html - command: > - /bin/sh -c 'sleep 10; wp core install --url=https://$APP_DOMAIN --title="Le Noctambule" --admin_name=$WP_ADMIN --admin_password=$WP_ADMIN_PWD --admin_email=$WP_ADMIN_EMAIL; wp user create $WP_USER $WP_EMAIL --user_pass=$WP_PWD --role=author' + command: > + /bin/sh -c ' + sleep 10; + until wp core install \ + --url=https://$APP_DOMAIN \ + --title="Le Noctambule" \ + --admin_name=$WP_ADMIN \ + --admin_password=$WP_ADMIN_PWD \ + --admin_email=$WP_ADMIN_EMAIL + do + echo "Waiting for WordPress to be ready..."; + sleep 5; + done; + + until wp user create \ + $WP_USER $WP_EMAIL \ + --user_pass=$WP_PWD \ + --role=author + do + echo "Retrying user creation..."; + sleep 5; + done; + ' nginx: container_name: nginx image: nginx:latest diff --git a/inventory/remote.yml b/inventory/remote.yml new file mode 100644 index 0000000..0c7c894 --- /dev/null +++ b/inventory/remote.yml @@ -0,0 +1,5 @@ +hosts: + hosts: + 161.35.155.92: + ansible_port: 22 + ansible_user: root \ No newline at end of file diff --git a/templates/.env.j2 b/templates/.env.j2 index 45d705b..756bf22 100644 --- a/templates/.env.j2 +++ b/templates/.env.j2 @@ -7,4 +7,4 @@ WP_EMAIL={{WP_EMAIL}} WP_ADMIN={{WP_ADMIN}} WP_ADMIN_PWD={{WP_ADMIN_PWD}} WP_ADMIN_EMAIL={{WP_ADMIN_EMAIL}} -APP_DOMAIN={{cert_domain}} \ No newline at end of file +APP_DOMAIN={{ inventory_hostname }} \ No newline at end of file diff --git a/vars.yml b/vars.yml index 16ab529..05d30b4 100644 --- a/vars.yml +++ b/vars.yml @@ -1,7 +1,6 @@ is_local: true passphrase: changeme -cert_domain: "example.com" -cert_email: "admin@example.com" +cert_domain: "{{ inventory_hostname }}" dest_dir: /var/app/ cert_path: "{{ dest_dir }}/srcs/nginx/certbot/conf/live/{{ cert_domain }}"