% cat split.yml
---
- name: test splitting text
hosts: localhost
become: false
gather_facts: false
vars:
text_to_split1: "18:37:01 up 5 days, 4:37, 2 users, load average: 0.02,
0.05, 0.00"
text_to_split2: "12:58:10 up 6:51, 0 users, load average: 1.08, 0.99,
1.05"
tasks:
- name: get the load average text
debug:
msg:
- "{{ text_to_split1.split()[-3:] }}"
- "{{ text_to_split2.split()[-3:] }}"
% ansible-playbook -i localhost, split.yml
PLAY [test splitting text]
*********************************************************************************************
TASK [get the load average text]
***************************************************************************************
ok: [localhost] => {
"msg": [
[
"0.02,",
"0.05,",
"0.00"
],
[
"1.08,",
"0.99,",
"1.05"
]
]
}
PLAY RECAP
*************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0
skipped=0 rescued=0 ignored=0
Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
--
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/6A84D45C-C18C-455C-9AB8-CE30D18B1D00%40nist.gov.