diff --git a/tripleo_ansible/roles/tripleo-hosts-entries/molecule/default/prepare.yml b/tripleo_ansible/roles/tripleo-hosts-entries/molecule/default/prepare.yml index ef85c3128..50ae900dd 100644 --- a/tripleo_ansible/roles/tripleo-hosts-entries/molecule/default/prepare.yml +++ b/tripleo_ansible/roles/tripleo-hosts-entries/molecule/default/prepare.yml @@ -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 }}" diff --git a/tripleo_ansible/roles/tripleo-hosts-entries/tasks/main.yml b/tripleo_ansible/roles/tripleo-hosts-entries/tasks/main.yml index 22ad54a63..3cb975c32 100644 --- a/tripleo_ansible/roles/tripleo-hosts-entries/tasks/main.yml +++ b/tripleo_ansible/roles/tripleo-hosts-entries/tasks/main.yml @@ -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: