Ansible and rhn_register

111 views
Skip to first unread message

Néstor Flórez

unread,
Aug 11, 2015, 10:59:50 AM8/11/15
to Ansible Project
I am trying my first ansible playbook and I want to register to red hat and do a
yum update and then unregister using the rhn_register modules

The first 2 tasks are working but the last task to unregister fails:
------------

PLAY [linux] ******************************************************************

GATHERING FACTS ***************************************************************
<192.168.1.150> REMOTE_MODULE setup
ok: [192.168.1.150]

TASK: [RHN register] **********************************************************
<192.168.1.150> REMOTE_MODULE rhn_register state=present username=rhnuser password=VALUE_HIDDEN
ok: [192.168.1.150] => {"changed": false, "msg": "System already registered."}

TASK: [yum update] ************************************************************
<192.168.1.150> REMOTE_MODULE yum name=* state=latest
ok: [192.168.1.150] => {"changed": false, "msg": "", "rc": 0, "results": ["All packages up to date"]}

TASK: [RHN Unregister this server] ********************************************
<192.168.1.150> REMOTE_MODULE rhn_register state=absent username=rhnuser password=VALUE_HIDDEN
failed: [192.168.1.150] => {"failed": true}
msg: Failed to unregister: <Fault 1003: 'The following systems were NOT deleted: \n1039724772'>

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/home/myuser/yum_update.retry

192.168.1.150               : ok=3    changed=0    unreachable=0    failed=1

-----------------


---------- my playbook ------------
# This playbook does a RHEL yum update on the linux systems

- hosts: linux
  user: myuser

  tasks:
  # Register as user (joe_user) with password (somepass) and auto-subscribe to available content.
    - name: RHN register
      rhn_register: state=present username=rhnuser password=mypwd

  # Yum update
    - name: yum update
      yum: name=* state=latest

  # Unregister system
    - name: RHN Unregister this server
      rhn_register: state=absent username=rhnuser password=mypwd
-------------


Welcome any ideas - THANSK!!!

Néstor Flórez

unread,
Aug 11, 2015, 12:01:57 PM8/11/15
to Ansible Project
Go it to work!!!

The register portion was working and the register portion was giving errors.
then all of a sudden the register part started to failed with error line:9 of rhnplugin.conf
  
Some how my /etc/yum/pluginconf.d/rhnplugin.conf had syntax error but other
linux rhel server did not have the same problem. 

I have never edited this file until today.  

After fixing the syntax error it worked!!!

Thanks,

Marcus Franke

unread,
Aug 11, 2015, 12:05:12 PM8/11/15
to Ansible Project

Hi,

did you check for the error message from the failed task? This looks like an error message from you satellite server you were trying to unregister from and not like an ansible error.

Register, update, unregister sounds like you are trying to save licenses for your servers and the error sounds like the satellite server knows about this ;-)


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4f2f396c-e12b-458c-8c5c-d8d377cf16f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Néstor

unread,
Aug 11, 2015, 2:39:39 PM8/11/15
to ansible...@googlegroups.com
That is the idea, I have 2 licenses but I only keep my live server register at all time.  I have a backup and desktop server.   YEs, I want to register and unregister the backup and the desktop just to get the latest updates but the desktop is my test/play desktop server

I was trying that on only on desktop server server and it was failing because of the conf having an error..

It keep giving me the error messages that I put in the first message, and then I did it a 5th time and it said that I had a syntax error in the conf file but the difference is that I thing the last time I ran it, I did it with '-vvvv'

Thanks,



--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/R1P9VVXc-gk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Né§t☼r  Authority gone to one's head is the greatest enemy of Truth
Reply all
Reply to author
Forward
0 new messages