On Friday, 17 November 2017 17.46.20 CET [email protected] wrote:
> Yes kai it was the problem!
> 
> Now i am sure the number of exit is correct and the configuration go fine, 
> at the end now i get this message, even if the configuration is done i get 
> such an error how can i avoid it? I mean now this error it is not an error, 
> after i finished the configuration i exited the CLI and that's all.
> 

<snip />

> *    "msg": "non-zero return code",*
> *    "rc": 1,*

The telnet command is returning return code 1, and Ansible takes that as a 
failure.


<snip />

> *        "Global configuration mode",*
> *        "idg(config)# web-mgmt",*
> *        "Modify Web Management Service configuration",*
> *        "",*
> *        "idg(config web-mgmt)# admin-state enabled",*
> *        "idg(config web-mgmt)# local-address 127.0.0.1 9090",*
> *        "idg(config web-mgmt)# exit",*
> *        "",*
> *        "% The appliance is in failsafe console mode. Only the default 
> domain and a serial console interface are active. In this failsafe mode the 
> appliance cannot accept client requests. Contact IBM Support.",*
> *        "",*
> *        "idg(config)# write memory",*
> *        "",*
> *        "% Saving configuration failed - disabled.",*
> *        "",*
> *        "idg(config)# exit",*
> *        "",*
> *        "% The appliance is in failsafe console mode. Only the default 
> domain and a serial console interface are active. In this failsafe mode the 
> appliance cannot accept client requests. Contact IBM Support.",*
> *        "",*
> *        "idg# exit",*
> *        "Goodbye.",*
> *        "Connection closed by foreign host."*
> *    ]*
> *}*

This looks good but sometime some HW return an error anyway.
Fortunately you have options to handle this[1].

One is to set

  ignore_errors: true

on the task, personally I don't like this one, since the output still looks 
like something went wrong.
The other alternative is adding

  fail_when: false

or

  register: result
  failed_when: result.rc > 1

to the task.


[1] https://docs.ansible.com/ansible/latest/playbooks_error_handling.html

-- 
Kai Stian Olstad

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1769134.7ZWcQUlFGq%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to