From 7e74ce2ede40043afad09aaf2c7c166734ca4a3a Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:42:21 -0400 Subject: [PATCH] Add support for arbitrary /etc/hosts entries --- group_vars/default/base.yml | 5 +++++ roles/base/templates/etc/hosts.j2 | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/group_vars/default/base.yml b/group_vars/default/base.yml index 164b00f..f7a6781 100644 --- a/group_vars/default/base.yml +++ b/group_vars/default/base.yml @@ -19,6 +19,11 @@ logrotate_interval: daily # Root email name (usually "root") username_email_root: root +# Hosts entries +hosts: + - name: test + ip: 127.0.0.1 + # Administrative shell users for the cluster admin_users: - name: "myuser" diff --git a/roles/base/templates/etc/hosts.j2 b/roles/base/templates/etc/hosts.j2 index e19c1ff..2cfc6a7 100644 --- a/roles/base/templates/etc/hosts.j2 +++ b/roles/base/templates/etc/hosts.j2 @@ -10,3 +10,9 @@ ff02::2 ip6-allrouters {{ node.cluster_ip }} {{ node.hostname }}.{{ pvc_cluster_domain }} {{ node.hostname }} {{ node.storage_ip }} {{ node.hostname }}.{{ pvc_storage_domain }} {% endfor %} + +{% if hosts is defined %} +{% for host in hosts %} +{{ host.ip }} {{ host.name }} +{% endfor %} +{% endif %}