inserted 'fqdn' variable so use of inventory hostname as a fully qualified domain name for managed node or target host services could be overridden
This commit is contained in:
@@ -34,13 +34,13 @@
|
|||||||
- name: Updating hostname
|
- name: Updating hostname
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.hostname:
|
ansible.builtin.hostname:
|
||||||
name: "{{ inventory_hostname }}"
|
name: "{{ fqdn | default(inventory_hostname) }}"
|
||||||
- name: Updating hosts file
|
- name: Updating hosts file
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
regexp: "^127\\.0\\.1\\.1"
|
regexp: "^127\\.0\\.1\\.1"
|
||||||
line: "127.0.1.1 {{ inventory_hostname }}"
|
line: "127.0.1.1 {{ fqdn | default(inventory_hostname) }}"
|
||||||
insertbefore: BOF
|
insertbefore: BOF
|
||||||
state: present
|
state: present
|
||||||
- name: Updating host icon name
|
- name: Updating host icon name
|
||||||
|
|||||||
@@ -37,13 +37,13 @@
|
|||||||
- name: Updating hostname
|
- name: Updating hostname
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.hostname:
|
ansible.builtin.hostname:
|
||||||
name: "{{ inventory_hostname }}"
|
name: "{{ fqdn | default(inventory_hostname) }}"
|
||||||
- name: Updating hosts file
|
- name: Updating hosts file
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
regexp: "^127\\.0\\.1\\.1"
|
regexp: "^127\\.0\\.1\\.1"
|
||||||
line: "127.0.1.1 {{ inventory_hostname }}"
|
line: "127.0.1.1 {{ fqdn | default(inventory_hostname) }}"
|
||||||
insertbefore: BOF
|
insertbefore: BOF
|
||||||
state: present
|
state: present
|
||||||
- name: Updating host icon name
|
- name: Updating host icon name
|
||||||
|
|||||||
@@ -38,10 +38,10 @@
|
|||||||
- name: Exemplifying needed ACME record
|
- name: Exemplifying needed ACME record
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
acme_record: |
|
acme_record: |
|
||||||
{{ inventory_hostname }} IN A {{ ipify_public_ip }}
|
{{ fqdn | default(inventory_hostname) }} IN A {{ ipify_public_ip }}
|
||||||
_acme-challenge.{{ inventory_hostname }} IN CNAME {{ inventory_hostname }}.acme.{{ inventory_hostname }}.
|
_acme-challenge.{{ fqdn | default(inventory_hostname) }} IN CNAME {{ fqdn | default(inventory_hostname) }}.acme.{{ fqdn | default(inventory_hostname) }}.
|
||||||
acme.{{ inventory_hostname }} IN NS ns.acme.{{ inventory_hostname }}.
|
acme.{{ fqdn | default(inventory_hostname) }} IN NS ns.acme.{{ fqdn | default(inventory_hostname) }}.
|
||||||
ns.acme.{{ inventory_hostname }} IN A {{ ipify_public_ip }}
|
ns.acme.{{ fqdn | default(inventory_hostname) }} IN A {{ ipify_public_ip }}
|
||||||
- name: Informing user of need to set up ACME record
|
- name: Informing user of need to set up ACME record
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Please set ACME record in domain name provider:\n {{ acme_record }}"
|
msg: "Please set ACME record in domain name provider:\n {{ acme_record }}"
|
||||||
|
|||||||
@@ -67,12 +67,12 @@
|
|||||||
when: data_method.user_input == "fetch"
|
when: data_method.user_input == "fetch"
|
||||||
block:
|
block:
|
||||||
- name: Informing user of inventory requirements for VPN clients
|
- name: Informing user of inventory requirements for VPN clients
|
||||||
when: not item.name in groups.homeserver
|
when: ((fqdn is undefined or fqdn == None) and item.name != fqdn) or not item.name in groups.homeserver
|
||||||
ansible.builtin.fail:
|
ansible.builtin.fail:
|
||||||
msg: The VPN client must be the name of an inventory host in a homeserver group
|
msg: The VPN client must be the name of an inventory host in a homeserver group
|
||||||
loop: "{{ vpn.clients }}"
|
loop: "{{ vpn.clients }}"
|
||||||
- name: Dupliciating DSNet VPN service client configuration files to control node
|
- name: Dupliciating DSNet VPN service client configuration files to control node
|
||||||
when: item.name in groups.homeserver
|
when: ((fqdn is defined and fqdn != None) and item.name == fqdn) or item.name in groups.homeserver
|
||||||
ansible.builtin.fetch:
|
ansible.builtin.fetch:
|
||||||
src: "{{ ansible_user_home.stdout }}/.wg/authorized_clients.d/{{ item.name }}{{ (idx | string) }}.conf"
|
src: "{{ ansible_user_home.stdout }}/.wg/authorized_clients.d/{{ item.name }}{{ (idx | string) }}.conf"
|
||||||
dest: "./.tmp/{{ inventory_hostname }}-dsnet/"
|
dest: "./.tmp/{{ inventory_hostname }}-dsnet/"
|
||||||
|
|||||||
@@ -181,7 +181,7 @@
|
|||||||
- name: Copying VPN client configuration files
|
- name: Copying VPN client configuration files
|
||||||
become: true
|
become: true
|
||||||
become_user: "{{ current_user.stdout }}"
|
become_user: "{{ current_user.stdout }}"
|
||||||
when: item.name == inventory_hostname
|
when: ((fqdn is defined and fqdn != None) and item.name == fqdn) or item.name == inventory_hostname
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "user/wg/containerized/{{ item.name }}{{ (idx | string) }}.conf"
|
src: "user/wg/containerized/{{ item.name }}{{ (idx | string) }}.conf"
|
||||||
dest: "{{ ansible_user_home.stdout }}/.wg/containerized/"
|
dest: "{{ ansible_user_home.stdout }}/.wg/containerized/"
|
||||||
@@ -772,7 +772,7 @@
|
|||||||
- name: Creating required tailnet container secret for tailnet container specified by Compose file
|
- name: Creating required tailnet container secret for tailnet container specified by Compose file
|
||||||
become: true
|
become: true
|
||||||
# become_user: "{{ current_user.stdout }}"
|
# become_user: "{{ current_user.stdout }}"
|
||||||
when: item.name == inventory_hostname
|
when: ((fqdn is defined and fqdn != None) and item.name == fqdn) or item.name == inventory_hostname
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ item.name }}-{{ headscale.users.admin.username }}@headscale/headscale{{ (idx | string) }}.key"
|
src: "{{ item.name }}-{{ headscale.users.admin.username }}@headscale/headscale{{ (idx | string) }}.key"
|
||||||
dest: "{{ ansible_user_home.stdout }}/.podsecrets/headscale.key"
|
dest: "{{ ansible_user_home.stdout }}/.podsecrets/headscale.key"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
CERTBOT_EMAIL="{{ certbot.email }}"
|
CERTBOT_EMAIL="{{ certbot.email }}"
|
||||||
CERTBOT_AUTHENTICATOR={{ certbot.auth_method }}
|
CERTBOT_AUTHENTICATOR={{ certbot.auth_method }}
|
||||||
SERVER_WEBROOT_PATH={{ ansible_user_home.stdout + "/srv/acme." + inventory_hostname }}
|
SERVER_WEBROOT_PATH={{ ansible_user_home.stdout + "/srv/certbot." + (fqdn | default(inventory_hostname)) }}
|
||||||
{% if compose.mode == "dev" %}
|
{% if compose.mode == "dev" %}
|
||||||
# @TODO find a better way to have processed the below in Ansible
|
# @TODO find a better way to have processed the below in Ansible
|
||||||
CERTBOT_CHALLENGE_DOMAINS={{ certbot.domains | map("regex_replace", "\\.([^\\.]*)$", ".test") | list | join(",") }}
|
CERTBOT_CHALLENGE_DOMAINS={{ certbot.domains | map("regex_replace", "\\.([^\\.]*)$", ".test") | list | join(",") }}
|
||||||
|
|||||||
@@ -1,11 +1,27 @@
|
|||||||
http://<< inventory_hostname >> {
|
http://<< web_fqdn >> {
|
||||||
handle /.well-known/acme-challenge/* {
|
handle /.well-known/acme-challenge/* {
|
||||||
reverse_proxy localhost:80
|
reverse_proxy localhost:80
|
||||||
}
|
}
|
||||||
|
handle {
|
||||||
|
redir https://{host}{uri} 308
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:80 {
|
:80 {
|
||||||
root * /srv/<< inventory_hostname >>
|
root /srv/certbot.<< web_fqdn >>
|
||||||
file_server
|
browse
|
||||||
encode gzip
|
}
|
||||||
|
<< web_fqdn >> {
|
||||||
|
respond 503
|
||||||
|
# root /srv/<< web_fqdn >>
|
||||||
|
file_server
|
||||||
|
|
||||||
|
header /.well-known/openpgpkey/* {
|
||||||
|
Content-Type application/octet-stream
|
||||||
|
Access-Control-Allow-Origin *
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_errors {
|
||||||
|
rewrite /error/{err.status_code}.html
|
||||||
|
templates
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ certbot:
|
|||||||
port: ~
|
port: ~
|
||||||
email: ajt95@prole.biz
|
email: ajt95@prole.biz
|
||||||
domains:
|
domains:
|
||||||
- "{{ inventory_hostname }}"
|
- "{{ fqdn | default(inventory_hostname) }}"
|
||||||
- "*.{{ inventory_hostname }}"
|
- "*.{{ fqdn | default(inventory_hostname) }}"
|
||||||
cron: "2 6 24 1 *"
|
cron: "2 6 24 1 *"
|
||||||
@@ -5,6 +5,6 @@ certbot:
|
|||||||
port: 53
|
port: 53
|
||||||
email: ajt95@prole.biz
|
email: ajt95@prole.biz
|
||||||
domains:
|
domains:
|
||||||
- "{{ inventory_hostname }}"
|
- "{{ fqdn | default(inventory_hostname) }}"
|
||||||
- "*.{{ inventory_hostname }}"
|
- "*.{{ fqdn | default(inventory_hostname) }}"
|
||||||
cron: ~
|
cron: ~
|
||||||
Reference in New Issue
Block a user