On Wed, 1 Jul 2020 02:43:24 -0700 (PDT) Jenisha T <[email protected]> wrote:
> Agent Communication Diagnostic Report
> -----------------------------------------------
>
> Agent User Name : username
> Agent Directory : /path/to/dir
> Agent Platform Architecture : Linux
> Agent Version : x.0.00.x
> Agent Host Name : abcdef1234
> Logical Agent Name : abcdef1234
> Listen to Network Interface : *ANY
>
> Agent processes status
> ======================
> Agent Listener : Running as root
Try this (given the string is in variable "my_data")
- set_fact:
my_agent: "{{ my_agent|default({})|
combine({my_key: my_val}) }}"
loop: "{{ my_data.splitlines()|
select('match', my_regex)|
list }}"
vars:
my_regex: '^(.*?):(.*)$'
my_key: "{{ item|
regex_replace(my_regex, '\\1')|
trim|
regex_replace(' ', '_') }}"
my_val: "{{ item|
regex_replace(my_regex, '\\2')|
trim }}"
- debug:
var: my_agent
- debug:
var: my_agent.Logical_Agent_Name
--
Vladimir Botka
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/20200702050513.1e7886ed%40gmail.com.
pgpgX5BHzNUue.pgp
Description: OpenPGP digital signature
