Streamlining setup of nginx base requriements
This commit is contained in:
parent
7edf24ba20
commit
c09dd6203f
@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: webhost
|
|
||||||
remote_user: root
|
|
||||||
vars:
|
|
||||||
websites:
|
|
||||||
- shockrah.xyz
|
|
||||||
tasks:
|
|
||||||
- name: Remove wget
|
|
||||||
apt:
|
|
||||||
name: wget
|
|
||||||
state: absent
|
|
||||||
- name: Clean out /opt/nginx/
|
|
||||||
file:
|
|
||||||
path: /opt/nginx/
|
|
||||||
state: absent
|
|
||||||
- name: Ensure /opt/nginx is still present
|
|
||||||
file:
|
|
||||||
state: directory
|
|
||||||
owner: nginx
|
|
||||||
path: /opt/nginx/
|
|
@ -1,35 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: webhost
|
|
||||||
remote_user: root
|
|
||||||
vars:
|
|
||||||
websites:
|
|
||||||
- shockrah.xyz
|
|
||||||
- resume.shockrah.xyz
|
|
||||||
- temper.tv
|
|
||||||
tasks:
|
|
||||||
- name: Add local routing for the server confs
|
|
||||||
lineinfile:
|
|
||||||
path: /etc/hosts
|
|
||||||
state: present
|
|
||||||
line: "127.0.0.1 {{ item }}"
|
|
||||||
loop: "{{ websites }}"
|
|
||||||
- name: Curl the local endpoints to check connection nginx reverse proxy
|
|
||||||
uri:
|
|
||||||
url: "http://{{ item }}"
|
|
||||||
status_code:
|
|
||||||
- 200
|
|
||||||
- 404
|
|
||||||
loop: "{{ websites }}"
|
|
||||||
- name: Sanity Check the nginx reverse proxy
|
|
||||||
uri:
|
|
||||||
url: "http://not-real.{{ item }}"
|
|
||||||
loop: "{{ websites }}"
|
|
||||||
register: result
|
|
||||||
failed_when: result.status != -1
|
|
||||||
- name: Cleanup /etc/hosts
|
|
||||||
lineinfile:
|
|
||||||
path: /etc/hosts
|
|
||||||
state: absent
|
|
||||||
line: "127.0.0.1 {{ item }}"
|
|
||||||
loop: "{{ websites }}"
|
|
||||||
|
|
@ -2,6 +2,13 @@
|
|||||||
---
|
---
|
||||||
- hosts: webhost
|
- hosts: webhost
|
||||||
remote_user: root
|
remote_user: root
|
||||||
|
vars:
|
||||||
|
websites:
|
||||||
|
- shockrah.xyz
|
||||||
|
- temper.tv
|
||||||
|
- resume.shockrah.xyz
|
||||||
tasks:
|
tasks:
|
||||||
- name: Setup nginx
|
- name: Setup nginx
|
||||||
import_tasks: ../tasks/nginx-setup.yml
|
import_tasks: ../tasks/nginx-setup.yml
|
||||||
|
- name: Test local sites
|
||||||
|
import_tasks: ../tasks/tests/local-site-presence.yml
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: webhost
|
|
||||||
remote_user: root
|
|
||||||
tasks:
|
|
||||||
- name: Echo something
|
|
||||||
shell: echo 'Testing playbook'
|
|
||||||
|
|
||||||
- name: Testing HTTP egress
|
|
||||||
shell: curl http://google.com
|
|
||||||
|
|
||||||
- name: Testing HTTPS egress
|
|
||||||
shell: curl https://google.com
|
|
@ -14,7 +14,7 @@
|
|||||||
path: /opt/nginx
|
path: /opt/nginx
|
||||||
- name: Copy over the nginx.conf files for each server
|
- name: Copy over the nginx.conf files for each server
|
||||||
copy:
|
copy:
|
||||||
src: "files/{{ item }}"
|
src: "../files/{{ item }}"
|
||||||
dest: /etc/nginx/sites-available/
|
dest: /etc/nginx/sites-available/
|
||||||
loop:
|
loop:
|
||||||
- shockrah.xyz.conf
|
- shockrah.xyz.conf
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
- name: Add local routing for the server confs
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/hosts
|
||||||
|
state: present
|
||||||
|
line: "127.0.0.1 {{ item }}"
|
||||||
|
loop: "{{ websites }}"
|
||||||
|
- name: Curl the local endpoints to check connection nginx reverse proxy
|
||||||
|
uri:
|
||||||
|
url: "http://{{ item }}"
|
||||||
|
status_code:
|
||||||
|
- 200
|
||||||
|
- 404
|
||||||
|
loop: "{{ websites }}"
|
||||||
|
- name: Sanity Check the nginx reverse proxy
|
||||||
|
uri:
|
||||||
|
url: "http://not-real.{{ item }}"
|
||||||
|
loop: "{{ websites }}"
|
||||||
|
register: result
|
||||||
|
failed_when: result.status != -1
|
||||||
|
- name: Cleanup /etc/hosts
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/hosts
|
||||||
|
state: absent
|
||||||
|
line: "127.0.0.1 {{ item }}"
|
||||||
|
loop: "{{ websites }}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user