我有一本剧本
---
- hosts: all
gather_facts: True
tasks:
- action: debug msg="time = {{ ansible_date_time }}"
它返回每台机器的完整 json 表示。如何在剧本中进一步过滤,以便我只得到 iso8601_basic_short 部分
[root@pjux playbooks]# ansible --version
ansible 2.1.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
任务[调试] ********************************************** ************************
ok: [10.99.97.222] => { "msg": "time = {u'weekday_number': u'2', u'iso8601_basic_short': u'20160906T182117', u'tz': u'BST', u' weeknumber': u'36', u'hour': u'18', u'year': u'2016', u'minute': u'21', u'tz_offset': u'+0100', u '月': u'09', u'epoch': u'1473182477', u'iso8601_micro': u'2016-09-06T17:21:17.761900Z', u'weekday': u'Tuesday', u'时间': u'18:21:17', u'日期': u'2016-09-06', u'iso8601': u'2016-09-06T17:21:17Z', u'day': u '06', u'iso8601_basic': u'20160906T182117761843', u'second': u'17'}" }
ok: [10.99.97.216] => { "msg": "time = {u'weekday_number': u'2', u'iso8601_basic_short': u'20160906T182117', u'tz': u'BST', u' weeknumber': u'36', u'hour': u'18', u'year': u'2016', u'minute': u'21', u'tz_offset': u'+0100', u '月': u'09', u'epoch': u'1473182477', u'iso8601_micro': u'2016-09-06T17:21:17.938563Z', u'weekday': u'Tuesday', u'时间': u'18:21:17', u'日期': u'2016-09-06', u'iso8601': u'2016-09-06T17:21:17Z', u'day': u '06', u'iso8601_basic': u'20160906T182117938491', u'second': u'17'}" }