diff --git a/library/system/hostname b/library/system/hostname index cca2364b611..c6d1f819451 100644 --- a/library/system/hostname +++ b/library/system/hostname @@ -285,7 +285,7 @@ class FedoraStrategy(GenericStrategy): (rc, out, err)) def get_permanent_hostname(self): - cmd = 'hostnamectl status | awk \'/^ *Static hostname:/{printf("%s", $3)}\'' + cmd = 'hostnamectl --static status' rc, out, err = self.module.run_command(cmd, use_unsafe_shell=True) if rc != 0: self.module.fail_json(msg="Command failed rc=%d, out=%s, err=%s" %