From 5776417314805652ae09835d536adb9a4f7e2811 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Wed, 21 Mar 2018 08:07:52 -0400 Subject: [PATCH] Replace only the word not the whole line. Also increase timeout of clone. --- playbooks/kvm.yml | 2 +- roles/common/tasks/main.yml | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/playbooks/kvm.yml b/playbooks/kvm.yml index a357c9c..36bf283 100644 --- a/playbooks/kvm.yml +++ b/playbooks/kvm.yml @@ -18,7 +18,7 @@ target: '{{ hypervisor }}' storage: 'SSD1' format: 'qcow2' - timeout: 3000 + timeout: 6000 register: cloned - name: Wait 10 seconds for proxmox to register the new node diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 63fc2e8..6a0e210 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -178,7 +178,8 @@ name: '{{ inventory_hostname }}' - name: Fix hosts file - lineinfile: dest=/etc/hosts - regexp="ubuntu" - state=present - line="{{ inventory_hostname }}" + replace: + path: /etc/hosts + regexp: '(\s+)ubuntu(\s+.*)?$' + replace: '\1{{ inventory_hostname }}\2' + backup: yes