[ADD] Uses a variable for the CNAME endpoint

This commit is contained in:
Jorge Enrique Gómez Gómez 2021-09-29 17:40:29 -05:00
parent 3c524456ba
commit 4dc5f2c911
3 changed files with 9 additions and 4 deletions

View File

@ -15,8 +15,9 @@ ansible-pull \
* Launches a new LXD container called **newodoocontainer**, that uses a LXD profile to download * Launches a new LXD container called **newodoocontainer**, that uses a LXD profile to download
and setup Odoo v14. and setup Odoo v14.
* Creates a DNS alias for **externo.agofer.net** called * Creates a DNS alias for **externo.agofer.net** or **externo2.agofer.net**
**newodoocontainer.agofer.net**. (see role variables in `local.yml` file), called
**<newodoocontainer>.agofer.net**.
* Registers this container in the existing Nginx Proxy container. * Registers this container in the existing Nginx Proxy container.
* Requests an SSL certificate to _Let's Encrypt_ for the new domain, storing * Requests an SSL certificate to _Let's Encrypt_ for the new domain, storing
the certificates in the Nginx Proxy container. the certificates in the Nginx Proxy container.
@ -33,4 +34,7 @@ A container called **nginx** should exist, with these packages already installed
lxc exec nginx -- apt -y install nginx certbot python3-certbot-nginx lxc exec nginx -- apt -y install nginx certbot python3-certbot-nginx
``` ```
This container should listen to external connections, in order to allow **Let's Encrypt** certificates to be assigned and renewed. It's strongly suggested to protect it using **fail2ban**, Geo-IP restrictions, or other security measures. This container should listen to external connections, in order to allow
**Let's Encrypt** certificates to be assigned and renewed. It's strongly
suggested to protect it using **fail2ban**, Geo-IP restrictions, or
other security measures.

View File

@ -16,6 +16,7 @@
- lxchost - lxchost
vars: vars:
dominio: agofer.net dominio: agofer.net
dnsalias: externo2
- hosts: nginx - hosts: nginx
gather_facts: yes gather_facts: yes

View File

@ -27,5 +27,5 @@
- name: Register DNS CNAME alias using Dreamhost API - name: Register DNS CNAME alias using Dreamhost API
uri: uri:
url: 'https://api.dreamhost.com/?key={{ apikey }}&cmd=dns-add_record&record={{ container }}.{{ dominio }}&type=CNAME&value=externo.{{ dominio }}.' url: 'https://api.dreamhost.com/?key={{ apikey }}&cmd=dns-add_record&record={{ container }}.{{ dominio }}&type=CNAME&value={{ dnsalias }}.{{ dominio }}.'