I got pb that based on output will say:
reboot required: True
or reboot required: False
if its false how do i skip the reboot on the following task?
I got pb that based on output will say:
reboot required: True
or reboot required: False
if its false how do i skip the reboot on the following task?
You probably need a handler with a changed_when condition.
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html#handlers
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_error_handling.html#defining-changed
See this discussion:
can i do something like this instead. using when condition
vmware_host_esxcli:
hostname: ‘{{ vcenter_hostname }}’
username: ‘{{ admin}}’
password: ‘{{ pass }}’
esxi_hostname: “{{ inventory_hostname }}”
validate_certs: no
cmd: ‘{{ cmd }}’
delegate_to: localhost
register: esxcli_output
debug:
var: esxcli_output.stdout_lines
vmware_host_powerstate:
hostname: ‘{{ vcenter_hostname }}’
username: ‘{{ admin}}’
password: ‘{{ pass }}’
esxi_hostname: “{{ inventory_hostname }}”
validate_certs: no
state: reboot-host
delegate_to: localhost
when: “esxcli_output.stdout_lines[0] != ‘Reboot Required: false’”