From 230d830612546e0426f82be3ce0a8f48611d8dae Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 5 Apr 2025 02:38:17 -0400 Subject: [PATCH] enable nginx dev --- .../host_vars/dev.balsillie.house/nginx.yaml | 9 +++++++++ ansible/playbooks/home.yml | 3 ++- ansible/roles/nginx/tasks/main.yaml | 16 ++++++++-------- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 ansible/inventory/host_vars/dev.balsillie.house/nginx.yaml diff --git a/ansible/inventory/host_vars/dev.balsillie.house/nginx.yaml b/ansible/inventory/host_vars/dev.balsillie.house/nginx.yaml new file mode 100644 index 0000000..41f1e35 --- /dev/null +++ b/ansible/inventory/host_vars/dev.balsillie.house/nginx.yaml @@ -0,0 +1,9 @@ +# code: language=ansible + +nginx_sites: + - name: repo.balsillie.house + type: site + autoindex: 'on' + root: /var/www/aur + +nginx_user: "http" diff --git a/ansible/playbooks/home.yml b/ansible/playbooks/home.yml index 0d4a46a..300382a 100644 --- a/ansible/playbooks/home.yml +++ b/ansible/playbooks/home.yml @@ -5,5 +5,6 @@ become: true gather_facts: true roles: - - certbot + # - certbot + - nginx # - aur_repo_host diff --git a/ansible/roles/nginx/tasks/main.yaml b/ansible/roles/nginx/tasks/main.yaml index 3dcda93..95c5c89 100644 --- a/ansible/roles/nginx/tasks/main.yaml +++ b/ansible/roles/nginx/tasks/main.yaml @@ -69,6 +69,7 @@ notify: Restart nginx - name: Template out nginx reverse proxy configs + when: item.type == "proxy" ansible.builtin.template: src: nginx-proxy.conf.j2 dest: /etc/nginx/sites-available/{{ item.name }}.conf @@ -76,10 +77,10 @@ group: root mode: "0644" loop: "{{ nginx_sites }}" - when: item.type == "proxy" notify: Restart nginx - name: Template out nginx site configs + when: item.type == "site" ansible.builtin.template: src: nginx-site.conf.j2 dest: /etc/nginx/sites-available/{{ item.name }}.conf @@ -87,7 +88,6 @@ group: root mode: "0644" loop: "{{ nginx_sites }}" - when: item.type == "site" notify: Restart nginx - name: Enable site configs @@ -98,12 +98,12 @@ loop: "{{ nginx_sites }}" notify: Restart nginx -- name: Run certbot role to install certificates - ansible.builtin.include_role: - name: certbot - vars: - certbot_domains: "{{ nginx_sites | map(attribute='name') }}" - certbot_notify: "Restart nginx" +# - name: Run certbot role to install certificates +# ansible.builtin.include_role: +# name: certbot +# vars: +# certbot_domains: "{{ nginx_sites | map(attribute='name') }}" +# certbot_notify: "Restart nginx" - name: Start and enable nginx ansible.builtin.service: