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