I have the following lists, generated from the output of a script.
['abc', 'abc-display-name']
['def', 'def-display-name']
['hij', 'hij-display-name']
I want to make use of the above output in ansible to construct and execute the following command
oc create project -n abc -d abc-display-name
I tried using the following, but its not working.
---
- hosts: localhost
gather_facts: no
tasks:
- name: Executing the python script
script: convert_to_list.py
register: new_bu_list
- name: Framing the oc commands
shell: "oc create project -n {{item[0]}} -d {{item[1]}}"
with_lines: "{{ new_bu_list.stdout_lines }}"
Not sure what am I doing wrong here. Any help would be much appreciated.