# "hostname" Module Does Not Work on RHEL 7

**URL:** <https://forum.ansible.com/t/hostname-module-does-not-work-on-rhel-7/15101>\
**Category:** Ansible Developer\
**Tags:** rhel\
**Created:** [April 28, 2014, 3:33pm UTC](https://forum.ansible.com/t/hostname-module-does-not-work-on-rhel-7/15101 "2014-04-28T15:33:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dustin\_C\_Hatch](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@Dustin\_C\_Hatch](https://forum.ansible.com/u/Dustin_C_Hatch)\
**Post date:** [April 28, 2014, 3:33pm UTC](https://forum.ansible.com/t/hostname-module-does-not-work-on-rhel-7/15101/1 "2014-04-28T15:33:09Z")

</div>

I've got some RHEL 7 machines already that need to be managed by  
Ansible. So far, the only problem I've found is that the "hostname"  
module fails to permanently set the hostname of the machine. This is  
because the HOSTNAME variable in /etc/sysconfig/network no longer has  
any effect, as RHEL 7 uses systemd. Looking through the code of the  
"hostname" module, I don't see any good way to fix this. It is using  
the "load\_platform\_subclass" utility function, which only works on the  
distribution name and ignores the version number.

Are there any current plans for being able to support different  
versions of distributions independently? What are your thoughts on how  
this should be done within Ansible? Right now, only "hostname" seems  
affected, but there could be others, now or in the future, so fixing  
it there doesn't seem to be the best option.

Regards,

Dustin C. Hatch  
[http://dustin.hatch.name/](http://dustin.hatch.name/)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 28, 2014, 9:19pm UTC](https://forum.ansible.com/t/hostname-module-does-not-work-on-rhel-7/15101/2 "2014-04-28T21:19:42Z")

</div>

You can look at what we do for returning OS version facts in the “setup” module…

Fixing it in the module that has the problem is 100% the right option.
