Ich versuche zu lernen, wie man Ansible Fakten als Variablen verwendet, und ich verstehe es nicht. Wenn ich renne ...Ansible Datum Variable
$ ansible localhost -m setup
... es listet alle Fakten meines Systems auf. Ich habe eine zufällig ausgewählt, um es zu benutzen, ansible_facts.ansible_date_time.date, aber ich kann nicht herausfinden, wie ich es benutzen soll. Wenn ich renne ...
$ ansible localhost -m setup -a "filter=ansible_date_time"
localhost | success >> {
"ansible_facts": {
"ansible_date_time": {
"date": "2015-07-09",
"day": "09",
"epoch": "1436460014",
"hour": "10",
"iso8601": "2015-07-09T16:40:14Z",
"iso8601_micro": "2015-07-09T16:40:14.795637Z",
"minute": "40",
"month": "07",
"second": "14",
"time": "10:40:14",
"tz": "MDT",
"tz_offset": "-0600",
"weekday": "Thursday",
"year": "2015"
}
},
"changed": false
}
Also, es ist klar da. Aber wenn ich renne ...
$ ansible localhost -a "echo {{ ansible_facts.ansible_date_time.date }}"
localhost | FAILED => One or more undefined variables: 'ansible_facts' is undefined
$ ansible localhost -a "echo {{ ansible_date_time.date }}"
localhost | FAILED => One or more undefined variables: 'ansible_date_time' is undefined
$ ansible localhost -a "echo {{ date }}"
localhost | FAILED => One or more undefined variables: 'date' is undefined
Was bekomme ich hier nicht? Wie verwende ich Fakten als Variablen?