Refactor and enhance Ansible configurations for dev-02 and nginx proxy setup
- Updated host_vars for dev-02 to include login history settings and modified code server authentication. - Adjusted opencode server configurations and reduced resource allocation. - Introduced a new playbook for configuring nginx reverse proxy with TLS and OAuth2. - Enhanced linux_dev_station role defaults and tasks, including package updates and service configurations. - Removed unnecessary credential assertions in linux_dev_station tasks. - Created nginx_proxy role with tasks for certbot, nginx installation, and oauth2-proxy setup. - Added templates for nginx and oauth2-proxy configurations. - Updated terraform configuration to reflect new DNS records for ide and agent services. - Documented changes and configurations in linux_dev_station.md for clarity and future reference.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
---
|
||||
- name: Validate nginx_proxy_sites is defined
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- nginx_proxy_sites is defined
|
||||
- nginx_proxy_sites | length > 0
|
||||
fail_msg: "nginx_proxy_sites must be defined with at least one site"
|
||||
|
||||
- name: Validate each site has required fields
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- item.server_name is defined
|
||||
- item.upstream is defined
|
||||
- item.upstream.host is defined
|
||||
- item.upstream.port is defined
|
||||
fail_msg: "Each site in nginx_proxy_sites must have server_name, upstream.host, and upstream.port"
|
||||
loop: "{{ nginx_proxy_sites }}"
|
||||
|
||||
- name: Calculate certbot domains from sites
|
||||
ansible.builtin.set_fact:
|
||||
__nginx_proxy_certbot_domains: "{{ nginx_proxy_sites | map(attribute='server_name') | list }}"
|
||||
when: nginx_proxy_certbot_domains is not defined
|
||||
|
||||
- name: Use explicit certbot domains when defined
|
||||
ansible.builtin.set_fact:
|
||||
__nginx_proxy_certbot_domains: "{{ nginx_proxy_certbot_domains }}"
|
||||
when: nginx_proxy_certbot_domains is defined
|
||||
|
||||
- name: Install certbot
|
||||
ansible.builtin.include_tasks: certbot.yml
|
||||
when: nginx_proxy_certbot_enabled | bool
|
||||
|
||||
- name: Install nginx
|
||||
ansible.builtin.include_tasks: nginx.yml
|
||||
when: nginx_proxy_nginx_enabled | bool
|
||||
|
||||
- name: Install oauth2-proxy
|
||||
ansible.builtin.include_tasks: oauth2_proxy.yml
|
||||
when: nginx_proxy_oauth2_proxy_enabled | bool
|
||||
Reference in New Issue
Block a user