diff --git a/playbooks/setup_webserver.yml b/playbooks/setup_webserver.yml new file mode 100644 index 0000000..964252c --- /dev/null +++ b/playbooks/setup_webserver.yml @@ -0,0 +1,27 @@ +--- +- name: installs and setups nginx on hosts + hosts: aws + become: true + vars: + gitea_website: gitea.kwerezigua.org + proxy: localhost:3000 + tasks: + - name: install nginx and supporting packages + apt: + name: "{{item}}" + state: latest + loop: + - caddy + - ufw + + + - name: edit caddyfile with desired services + ansible.builtin.template: + src: ../templates/Caddyfile.j2 + dest: /etc/caddy/Caddyfile + + - name: start caddy service + systemd: + name: caddy + state: started + enabled: true diff --git a/templates/Caddyfile.j2 b/templates/Caddyfile.j2 new file mode 100644 index 0000000..be1abb8 --- /dev/null +++ b/templates/Caddyfile.j2 @@ -0,0 +1,3 @@ +{{gitea_website}} { + reverse_proxy {{proxy}} +}