Change nginx role to staticweb

This commit is contained in:
2023-07-20 00:39:21 -04:00
parent 9b5be29a1a
commit f4f5b10395
4 changed files with 4 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
nginx_name: "{{ nginx_domain }}"
nginx_repo_branch: master
nginx_repo_dest: "{{ nginx_root }}/repository"
nginx_repo_key: "{{ nginx_root }}/id_rsa"
nginx_root: /opt/nginx/{{ nginx_name }}
nginx_html: "{{ nginx_root }}/html"

View File

@@ -0,0 +1,37 @@
- name: Create nginx root
ansible.builtin.file:
path: "{{ nginx_root }}"
state: directory
- name: Generate deploy keys
community.crypto.openssh_keypair:
path: "{{ nginx_repo_key }}"
state: present
- name: Clone static website files
ansible.builtin.git:
repo: "{{ nginx_repo_url }}"
dest: "{{ nginx_html }}"
version: "{{ nginx_repo_branch }}"
key_file: "{{ nginx_repo_key }}"
separate_git_dir: "{{ nginx_repo_dest }}"
- name: Start nginx container
community.general.docker_container:
name: "{{ nginx_name }}"
image: nginx:{{ nginx_version }}
state: started
restart_policy: always
networks_cli_compatible: true
networks:
- name: traefik
volumes:
- "{{ nginx_html }}:/usr/share/nginx/html:ro"
labels:
traefik.http.routers.nginx.rule: "Host(`{{ nginx_domain }}`)"
#traefik.http.middlewares.nginxauth.basicauth.users: "{{ nginx_auth }}"
traefik.http.routers.nginx.entrypoints: websecure
#traefik.http.routers.nginx.tls.certresolver: letsencrypt
#traefik.http.routers.nginx.middlewares: "securehttps@file,nginxauth"
traefik.docker.network: traefik
traefik.enable: "true"