2020-09-21 00:33:03 +00:00
|
|
|
- name: Create nginx root
|
2023-05-04 03:27:03 +00:00
|
|
|
ansible.builtin.file:
|
2020-09-21 00:33:03 +00:00
|
|
|
path: "{{ nginx_root }}"
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Generate deploy keys
|
2023-05-04 03:27:03 +00:00
|
|
|
community.crypto.openssh_keypair:
|
2020-09-21 00:33:03 +00:00
|
|
|
path: "{{ nginx_repo_key }}"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Clone static website files
|
2023-05-04 03:27:03 +00:00
|
|
|
ansible.builtin.git:
|
2020-09-21 00:33:03 +00:00
|
|
|
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
|
2023-05-04 03:27:03 +00:00
|
|
|
community.general.docker_container:
|
2020-09-21 00:33:03 +00:00
|
|
|
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 }}`)"
|
2022-08-17 05:40:11 +00:00
|
|
|
#traefik.http.middlewares.nginxauth.basicauth.users: "{{ nginx_auth }}"
|
2020-09-21 00:33:03 +00:00
|
|
|
traefik.http.routers.nginx.entrypoints: websecure
|
2022-08-19 01:53:38 +00:00
|
|
|
#traefik.http.routers.nginx.tls.certresolver: letsencrypt
|
|
|
|
#traefik.http.routers.nginx.middlewares: "securehttps@file,nginxauth"
|
2020-09-21 00:33:03 +00:00
|
|
|
traefik.docker.network: traefik
|
|
|
|
traefik.enable: "true"
|