From ce31381da4719813547df7a83c0c0fc80d2a22b3 Mon Sep 17 00:00:00 2001 From: Chris Coley <chris@codingallnight.com> Date: Sat, 16 Jun 2018 15:15:56 -0700 Subject: [PATCH] Update the 'ansible_hostname' fact after we set the hostname --- tasks/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index cccda87..4b29d70 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -20,6 +20,9 @@ regexp: '^127.0.1.1' line: '127.0.1.1 {{ hostname }}' state: present + - name: Set 'ansible_hostname' fact to the new hostname + set_fact: + ansible_hostname: '{{ hostname }}' when: hostname is defined and hostname != None and hostname != '' # Install common packages and utils -- GitLab