diff options
author | Dmitry Ilvokhin <d@ilvokhin.com> | 2024-01-06 19:25:23 +0000 |
---|---|---|
committer | Dmitry Ilvokhin <d@ilvokhin.com> | 2024-01-06 19:25:23 +0000 |
commit | 579d880e9921a87133d11cb15285c7f39db83260 (patch) | |
tree | 49b8bb42ed2373497ed00ef551a033657254c0dd /roles/ip | |
parent | 504fb5e84489636c16c15b00a99b0e6352304dcc (diff) | |
download | infra-579d880e9921a87133d11cb15285c7f39db83260.tar.gz infra-579d880e9921a87133d11cb15285c7f39db83260.tar.bz2 infra-579d880e9921a87133d11cb15285c7f39db83260.zip |
Make ip.ilvokhin.com a role
Diffstat (limited to 'roles/ip')
-rw-r--r-- | roles/ip/files/ip.ilvokhin.com | 28 | ||||
-rw-r--r-- | roles/ip/tasks/main.yml | 10 |
2 files changed, 38 insertions, 0 deletions
diff --git a/roles/ip/files/ip.ilvokhin.com b/roles/ip/files/ip.ilvokhin.com new file mode 100644 index 0000000..0555c67 --- /dev/null +++ b/roles/ip/files/ip.ilvokhin.com @@ -0,0 +1,28 @@ +server { + server_name ip.ilvokhin.com www.ip.ilvokhin.com; + + location / { + default_type text/plain; + return 200 $remote_addr\n; + } + + listen 443 ssl; + ssl_certificate /etc/letsencrypt/live/ip.ilvokhin.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/ip.ilvokhin.com/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; +} + +# Do not redirect to https to get a plain output for `curl ip.ilvokhin.com` +# command. +server { + server_name ip.ilvokhin.com www.ip.ilvokhin.com; + + location / { + default_type text/plain; + return 200 $remote_addr\n; + } + + listen 80; + listen [::]:80; +} diff --git a/roles/ip/tasks/main.yml b/roles/ip/tasks/main.yml new file mode 100644 index 0000000..ad584f4 --- /dev/null +++ b/roles/ip/tasks/main.yml @@ -0,0 +1,10 @@ +- ansible.builtin.include_role: + name: nginx + +- name: Configure nginx for ip.ilvokhin.com + ansible.builtin.copy: + src: files/ip.ilvokhin.com + dest: /etc/nginx/sites-available + owner: root + group: root + mode: u+rw,g+r,o+r |