- name: Extracting Hostname
local_action: command /usr/bin/perl extracturl.pl {{ url }} port
register: port
I can get the value in stdout “80”
“stderr”: “”, “stderr_lines”: , “stdout”: “80”, “stdout_lines”: [“80”]
local_action: command /usr/bin/perl extracturl.pl {{ url }} port
register: port
I can get the value in stdout “80”
“stderr”: “”, “stderr_lines”: , “stdout”: “80”, “stdout_lines”: [“80”]
Hi All,
I am capturing the script output in the ansible play using register and using it on another role. The register value
contains some additional characters.- name: Extracting Hostname
local\_action: command /usr/bin/perl extracturl\.pl \{\{ url \}\} port register: port
I can get the value in stdout "80"
"stderr": "", "stderr_lines": , "stdout": "80", "stdout_lines": ["80"]
Using port.stdout in a another task. Here is the issue. I am getting [u'80'] in {{ port.stdout }} .
- include_role:
name: roles/telnet vars: telnet\_port \- "\{\{ port\.stdout \}\}"
Any idea how to get rid of [u''] . Just I need the port no: 80
vars:
telnet_port: "{{ port.stdout }}"
In your task the - turns it into a list.
Regards
Racke
Hi Racke,
Fantastic, Thanks a lot for your reply. Removed - and it worked .
Cheers,
Joseph