Remove old Heat hosts entries in tripleo-hosts-entries

For upgrades, this role now takes care of removing the old Heat entries
if they are present in /etc/hosts. The test prepare process has been
updated to create a temp file that would replicate what we'd expect
in a live system.

Change-Id: Ifc4d9553b74e6e6a9794902b418f54c0cfc7a39d
This commit is contained in:
James Slagle 2019-10-29 16:37:47 -04:00 committed by Kevin Carter
parent 0a82a97f89
commit 0c0ea09be7
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
2 changed files with 22 additions and 1 deletions

View File

@ -14,8 +14,16 @@
# License for the specific language governing permissions and limitations
# under the License.
- name: Prepare
hosts: all
roles:
- role: test_deps
post_tasks:
- name: Create temp host file
copy:
content: |
HEAT_HOSTS_START - Do not edit manually within this section!
0.0.0.0 test test.domain.local
0.0.0.1 test test.domain.local
HEAT_HOSTS_END
dest: "{{ tripleo_hosts_entries_hosts_path }}"

View File

@ -14,6 +14,19 @@
# License for the specific language governing permissions and limitations
# under the License.
- name: Remove old Heat hosts configuration (if present)
become: true
blockinfile:
state: absent
path: "{{ tripleo_hosts_entries_hosts_path }}"
block: ""
marker: "# {mark}"
marker_begin: "HEAT_HOSTS_START - Do not edit manually within this section!"
marker_end: "HEAT_HOSTS_END"
tags:
- tripleo_hosts_entries
- name: Update /etc/hosts
become: true
blockinfile: