Hi there
I have some troubles to get register variable from local_action. Here is what I have:
---
- name: deploy something
hosts: all
sudo: True
vars:
hostname: ${ansible_hostname}
tasks:
- name: Checking
local_action: command /bin/something ${hostname}
register: status
- name: doing something
local_action: command /bin/something_else ${hostname}
only_if: "$status.rc != 0"
- name: deploying to remote nodes
action: template src=/var/repository/config.j2 dest=/etc/config owner=root group=root mode=0644
And here is what I get:
(...)
TASK: [Checking] *********************
skipping: [Host_A]
TASK: [doing something] *********************
fatal: [Host_A] => Could not evaluate the expression: $git_exists.rc != 0
FATAL: all hosts have already failed -- aborting
(...)
Why is task "Checking" skipped and why that expression cannot be evaluated?
Thanks
Edgars