From 9879d3b5db84e25853f4968314a6843f7fd41353 Mon Sep 17 00:00:00 2001 From: Brendan Date: Fri, 16 Apr 2021 20:55:18 +1000 Subject: [PATCH] Write hosts entries per environment This change will write /etc/hosts entries per plan rather than stomping the hosts entries every time the role is used for different stacks / plans. We achieve this by differentiating the blocks of IP addresses to ensure they are not modified by unrelated executions of the role. Closes-Bug: #1924751 RHBZ: 1933528 Depends-On: I9e53187f37d41d7180e66db1239b5f9c8846addd Change-Id: I7396ad4d25fec44000ead88b24e818abc107b5f8 --- .../roles/tripleo_hosts_entries/molecule/default/molecule.yml | 2 ++ tripleo_ansible/roles/tripleo_hosts_entries/tasks/main.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/tripleo_ansible/roles/tripleo_hosts_entries/molecule/default/molecule.yml b/tripleo_ansible/roles/tripleo_hosts_entries/molecule/default/molecule.yml index d83ebe958..ac68c9e2a 100644 --- a/tripleo_ansible/roles/tripleo_hosts_entries/molecule/default/molecule.yml +++ b/tripleo_ansible/roles/tripleo_hosts_entries/molecule/default/molecule.yml @@ -41,6 +41,8 @@ provisioner: tripleo_hosts_entries_undercloud_hosts_entries: [] tripleo_hosts_entries_extra_hosts_entries: [] tripleo_hosts_entries_vip_hosts_entries: [] + tripleo_stack_name: overcloud + plan: overcloud cloud_domain: localdomain enabled_networks: - ctlplane diff --git a/tripleo_ansible/roles/tripleo_hosts_entries/tasks/main.yml b/tripleo_ansible/roles/tripleo_hosts_entries/tasks/main.yml index e0e4a8f5a..d8bc5cab9 100644 --- a/tripleo_ansible/roles/tripleo_hosts_entries/tasks/main.yml +++ b/tripleo_ansible/roles/tripleo_hosts_entries/tasks/main.yml @@ -85,6 +85,9 @@ tripleo_hosts_entries_extra_hosts_entries | default([]) %} {{ host }} {% endfor %} + marker: "# {mark}" + marker_begin: "START_HOST_ENTRIES_FOR_STACK: {{ tripleo_stack_name | default(plan) }}" + marker_end: "END_HOST_ENTRIES_FOR_STACK: {{ tripleo_stack_name | default(plan) }}" register: tripleo_hosts_entries_new_entries tags: - tripleo_hosts_entries