From 3b5a8e2c5425450c0343358ba573f2a9c7d6fc87 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Sun, 17 Nov 2019 21:01:11 -0500 Subject: [PATCH] 0.1.15-DEV-20191117-205920 -------------------------- * ADD: - add tags to each task - added clean deploy task for site removals; will only run if task tag is used - added tower2.thezengarden.net to site list for testing awx installs/upgrades * MODIFY: - modified awx site reference to be tower --- defaults/main/proxy_site_defs.yml | 2 +- defaults/main/proxy_sites.yml | 8 +++++++- tasks/main.yml | 15 +++++++++++++++ templates/proxy_site.j2 | 5 +++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/defaults/main/proxy_site_defs.yml b/defaults/main/proxy_site_defs.yml index c9a208d..09b78cd 100644 --- a/defaults/main/proxy_site_defs.yml +++ b/defaults/main/proxy_site_defs.yml @@ -3,7 +3,7 @@ proxy_site_conf_dir : /etc/nginx/conf.d proxy_site_file : "{{ proxy_site_conf_dir }}/zen_proxy.conf" proxy_site_version : 1.8 - proxy_site_revision : 20191031-132522 + proxy_site_revision : 20191113-214118 proxy_site_log_path : /proxy_logs diff --git a/defaults/main/proxy_sites.yml b/defaults/main/proxy_sites.yml index d6a8179..dc63b4d 100644 --- a/defaults/main/proxy_sites.yml +++ b/defaults/main/proxy_sites.yml @@ -101,12 +101,18 @@ proxy_sites: max_upload : "{{ proxy_default_max_upload }}" - awx.thezengarden.net: + tower.thezengarden.net: proto : http dest : awx.thezengarden.net port : 80 + tower2.thezengarden.net: + proto : http + dest : awx2.thezengarden.net + port : 80 + + dashboard.thezengarden.net: proto : https dest : "{{ proxy_default_host }}" diff --git a/tasks/main.yml b/tasks/main.yml index a38efac..c6ee76d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,6 +3,7 @@ - name: alter package list for centos set_fact: proxy_package_list: ['nginx','git'] + tags: always when: ansible_distribution == "CentOS" @@ -10,20 +11,30 @@ package: name : "{{ proxy_package_list }}" state : present + tags: always - name: enable nginx at boot time service: name : nginx enabled : yes + tags: always when: ansible_virtualization_type != "docker" +- name: clean conf.d + file: + path: "{{ proxy_site_conf_dir }}" + state: absent + tags: ['clean_deploy','never'] + + - name: create conf.d directory file: path : "{{ proxy_site_conf_dir }}" state : directory mode : 0755 + tags: always - name: create log directory @@ -31,6 +42,7 @@ path : "{{ proxy_site_log_path }}" state : directory mode : 0755 + tags: always - name: clone ssl certs @@ -38,6 +50,7 @@ repo: "{{ ssl_repo }}" dest: "{{ proxy_site_ssl_directory }}" version: "{{ ssl_repo_branch }}" + tags: always notify: restart nginx @@ -48,6 +61,7 @@ mode : 0644 with_dict: - "{{ proxy_sites }}" + tags: always notify: restart nginx @@ -55,4 +69,5 @@ service: name : nginx state : started + tags: always when: ansible_virtualization_type != "docker" \ No newline at end of file diff --git a/templates/proxy_site.j2 b/templates/proxy_site.j2 index 1cc48ba..171b955 100644 --- a/templates/proxy_site.j2 +++ b/templates/proxy_site.j2 @@ -35,6 +35,11 @@ client_max_body_size {{ proxy_sites[item.key]['max_upload'] }}; proxy_set_header X-Forwarded-Proto https; proxy_set_header Host $host; + {% if item.key == "tower.thezengarden.net" or item.key == "tower2.thezengarden.net" %} +proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + {% endif %} + proxy_pass {{ proxy_sites[item.key]['proto'] }}://{{ proxy_sites[item.key]['dest'] }}:{{ proxy_sites[item.key]['port'] }};