# msg: hostname module cannot be used on platform Linux (Centos linux)

**URL:** <https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737>\
**Category:** Ansible Project\
**Tags:** aws, galaxy-ng\
**Created:** [November 11, 2015, 8:44pm UTC](https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737 "2015-11-11T20:44:02Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 13, 2015, 11:40pm UTC](https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737/21 "2015-11-13T23:40:39Z")

</div>

so from the code, this should work when ansible\_distribution":  
"CentOS" but not when ansible\_distribution": "CentOS Linux"

---

<div class="post-metadata">

**Author:** ![jdelaporte](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jdelaporte/32/366_2.png) [@jdelaporte](https://forum.ansible.com/u/jdelaporte)\
**Post date:** [November 14, 2015, 12:01am UTC](https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737/22 "2015-11-14T00:01:21Z")

</div>

There’s a class for ‘Centos’ at line 449, and another for ‘Centos linux’ at line 458, if you are looking at the Hostname module.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 14, 2015, 3:04am UTC](https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737/23 "2015-11-14T03:04:45Z")

</div>

So i checked again, i had misread the code it does not match class  
name but the declared distribution variable inside, this SHOULD match  
all versions of Centos.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 14, 2015, 3:58am UTC](https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737/24 "2015-11-14T03:58:10Z")

</div>

just tested on a new 7.1 vm and hostname module works w/o any issues.

---

<div class="post-metadata">

**Author:** ![jdelaporte](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jdelaporte/32/366_2.png) [@jdelaporte](https://forum.ansible.com/u/jdelaporte)\
**Post date:** [November 14, 2015, 4:56am UTC](https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737/25 "2015-11-14T04:56:55Z")

</div>

What version Ansible are you using? I only have the AWS instance (no other installs) I provisioned today that’s 7.1 right now, but it’s the latest one to have failed.

I am wondering if the version of python on my control machine would make a difference. I don’t know why it would, but it’s odd that every (Centos) host I point to has the same problem, when you and gregswift have both succeeded with 7.1 targets. My control machine is Slackware 14.1. Its Python version is 2.7.3.

I’ll mull it over and likely try using a different control machine next…Ubuntu or CentOS.

I should write a playbook to clone all my repos/roles from bitbucket, github, and galaxy so it’s easier to migrate controllers.

Thanks!  
Joanna

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [November 14, 2015, 5:24am UTC](https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737/26 "2015-11-14T05:24:51Z")

</div>

in this case the version of python on ansible machine should not  
matter, the module executes on the target machine. The version of  
ansible might matter as many changes were made to hostname module, I'm  
using 2.0/devel from git.

---

<div class="post-metadata">

**Author:** ![jdelaporte](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jdelaporte/32/366_2.png) [@jdelaporte](https://forum.ansible.com/u/jdelaporte)\
**Post date:** [November 17, 2015, 9:40pm UTC](https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737/27 "2015-11-17T21:40:49Z")

</div>

I did a fresh install on a new CentOS 7.1.1503. I got the same error response to the hostname module from my Slackware control machine.

I installed ansible 1.9.3 and git cloned enough over to my Ubuntu 14.04 laptop to rerun the same playbook against the same CentOS 7.1 target. The error was gone. All my CentOS targets respond just fine to my Ubuntu control machine. So…something is wonky with the control machine. It is running Slackware, so I’m not surprised.

Thanks for troubleshooting with me!  
Joanna

[Previous page](https://forum.ansible.com/t/msg-hostname-module-cannot-be-used-on-platform-linux-centos-linux/19737.md?page=1)
