On 19.10.2017 11:29, 'Tom Bartsch' via Ansible Project wrote:
Hi there,
could someone translate me the following playbook into python language?
I don't understand why you would need that, it's just a loop that print
thing out the the condition are met.
But since I'm in a process to learn Python why not.
---
- hosts: "{{ host }}"
vars:
static_jobs:
- templatename: "template1"
templateextension: "zip"
templateversion: "1.0.0"
- templatename: "template2"
templateextension: "zip"
templateversion: "2.0.0"
- templatename: "template3"
templateextension: "war"
templateversion: "4.5.0"
tasks:
- name: will not start message
debug: "msg='{{ item.templatename }} und dann {{
item.templateextension }} und am Ende {{ item.templateversion }} ...'"
with_items: "{{ static_jobs }}"
when: item.templateversion == "2.0.0"
static_jobs = [
{"templatename": "template1", "templateextension": "zip",
"templateversion": "1.0.0"},
{"templatename": "template2", "templateextension": "zip",
"templateversion": "2.0.0"},
{"templatename": "template3", "templateextension": "war",
"templateversion": "4.5.0"}
]
for item in static_jobs:
if item["templateversion"] == "2.0.0":
print item["templatename"] + " und dann " +
item["templateextension"] + " und am Ende " + item["templateversion"] +
"\n"
--
Kai Stian Olstad
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/5d18e07046cd98992729371f9c9b26fc%40olstad.com.
For more options, visit https://groups.google.com/d/optout.