diff --git a/tasks/openstack_update_hosts_file.yml b/tasks/openstack_update_hosts_file.yml index cffdb262..7023d627 100644 --- a/tasks/openstack_update_hosts_file.yml +++ b/tasks/openstack_update_hosts_file.yml @@ -13,35 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Update hosts file remove stale IP entries - lineinfile: - dest: /etc/hosts - regexp: "^{{ hostvars[item]['ansible_ssh_host'] }} (?!{{ item }}$)" - state: absent - with_items: - - "{{ groups['all_containers'] }}" - - "{{ groups['hosts'] }}" +- name: Drop hosts file entries script + template: + src: "openstack-host-hostfile-setup.sh.j2" + dest: "/usr/local/bin/openstack-host-hostfile-setup.sh" + mode: "0755" tags: - openstack-host-hostfile -- name: Update hosts file remove stale Host entries - lineinfile: - dest: /etc/hosts - regexp: "(?