# Issue with redhat\_subscription module #48302

**URL:** <https://forum.ansible.com/t/issue-with-redhat-subscription-module-48302/28970>\
**Category:** Ansible Project\
**Created:** [November 7, 2018, 6:56pm UTC](https://forum.ansible.com/t/issue-with-redhat-subscription-module-48302/28970 "2018-11-07T18:56:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabietto82](https://avatars.discourse-cdn.com/v4/letter/f/f6c823/32.png) [@fabietto82](https://forum.ansible.com/u/fabietto82)\
**Post date:** [November 7, 2018, 6:56pm UTC](https://forum.ansible.com/t/issue-with-redhat-subscription-module-48302/28970/1 "2018-11-07T18:56:52Z")

</div>

Hi,  
I'm trying to register new machines with ansible.  
Prior using ansible I used to run:  
subscription-manager register --org="MYCOMPANY" --activationkey="MYKEY"

In my ansible playbook i used redhat\_subscription module in this way:

- name: Register and subscribe to Satellite server  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redhat\_subscription:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state: present  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;activationkey: MYKEY  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;org\_id: MYCOMPANY  
when I try to run playbook i receive this error:

fatal: [1.1.1.1]: FAILED! =\> {"changed": false, "cmd": "/usr/sbin/subscription-manager register --org MYCOMPANY --activationkey VALUE\_SPECIFIED\_IN\_NO\_LOG\_PARAMETER", "msg": "Validation failed: Name hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123, Name hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123", "rc": 70, "stderr": "Validation failed: Name hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123, Name hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123\n", "stderr\_lines": ["Validation failed: Name hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123, Name hostname can contain only lowercase letters, numbers, dashes and dots according to RFC921, RFC952 and RFC1123"], "stdout": "", "stdout\_lines": }

I also tried to use organization id number instead name but it fails anyway.  
Where am i wronging?  
Thanks,  
Fabio

---

<div class="post-metadata">

**Author:** ![fabietto82](https://avatars.discourse-cdn.com/v4/letter/f/f6c823/32.png) [@fabietto82](https://forum.ansible.com/u/fabietto82)\
**Post date:** [November 8, 2018, 10:10am UTC](https://forum.ansible.com/t/issue-with-redhat-subscription-module-48302/28970/2 "2018-11-08T10:10:49Z")

</div>

Issue fixed. Hostname was set with “-” and after changed it (without -) everything is fine.  
Fabio
