diff --git a/infra/static-vultr/ansible/playbooks/download-publics.yml b/infra/static-vultr/ansible/playbooks/download-publics.yml deleted file mode 100644 index 802d563..0000000 --- a/infra/static-vultr/ansible/playbooks/download-publics.yml +++ /dev/null @@ -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/ diff --git a/infra/static-vultr/ansible/playbooks/remote-localized-curl-tests.yml b/infra/static-vultr/ansible/playbooks/remote-localized-curl-tests.yml deleted file mode 100644 index 7a4d120..0000000 --- a/infra/static-vultr/ansible/playbooks/remote-localized-curl-tests.yml +++ /dev/null @@ -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 }}" - diff --git a/infra/static-vultr/ansible/playbooks/static-host-setup.yml b/infra/static-vultr/ansible/playbooks/static-host-setup.yml index 8df5a53..f325ef6 100644 --- a/infra/static-vultr/ansible/playbooks/static-host-setup.yml +++ b/infra/static-vultr/ansible/playbooks/static-host-setup.yml @@ -2,6 +2,13 @@ --- - hosts: webhost remote_user: root + vars: + websites: + - shockrah.xyz + - temper.tv + - resume.shockrah.xyz tasks: - name: Setup nginx import_tasks: ../tasks/nginx-setup.yml + - name: Test local sites + import_tasks: ../tasks/tests/local-site-presence.yml diff --git a/infra/static-vultr/ansible/playbooks/test-setup.yml b/infra/static-vultr/ansible/playbooks/test-setup.yml deleted file mode 100644 index cc2e3b8..0000000 --- a/infra/static-vultr/ansible/playbooks/test-setup.yml +++ /dev/null @@ -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 diff --git a/infra/static-vultr/ansible/tasks/nginx-setup.yml b/infra/static-vultr/ansible/tasks/nginx-setup.yml index 9c2fcbb..8e7496c 100644 --- a/infra/static-vultr/ansible/tasks/nginx-setup.yml +++ b/infra/static-vultr/ansible/tasks/nginx-setup.yml @@ -14,7 +14,7 @@ path: /opt/nginx - name: Copy over the nginx.conf files for each server copy: - src: "files/{{ item }}" + src: "../files/{{ item }}" dest: /etc/nginx/sites-available/ loop: - shockrah.xyz.conf diff --git a/infra/static-vultr/ansible/tasks/tests/local-site-presence.yml b/infra/static-vultr/ansible/tasks/tests/local-site-presence.yml new file mode 100644 index 0000000..3e0023c --- /dev/null +++ b/infra/static-vultr/ansible/tasks/tests/local-site-presence.yml @@ -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 }}" +