Hi,
Not sure I follow, I understand that {{ item }} comes from with_file. The same as other loops
Maybe i'm missing something and I apologise
All I want to achieve is to conditionally handle the key if the path to a key is specified.
I also don't want it to log the key if its skipped and I want it to skip if the path isn't specified.
The docs don't mention using lookup
# Creates a new ec2 key pair named `example` if not present using provided key
# material
- name: example3 ec2 key
local_action:
module: ec2_key
name: example3
key_material: "{{ item }}"
with_file: /path/to/public_key.id_rsa.pub
Also just found that if the key changes the documentation claims that the key is returned. I just get the following message returned
TASK: [openbet/aws/ec2-security | Create ec2 key pair] ************************
changed: [localhost]
TASK: [openbet/aws/ec2-security | copy content={{ ec2_key }} dest="~/{{ec2_key_name}}.pem"] ***
ok: [localhost -> 127.0.0.1]
TASK: [openbet/aws/ec2-security | debug msg={{ ec2_key }}] ********************
ok: [localhost] => {
"msg": "{'invocation':"
}