Hello!
Here is the problem:
-
name: Check for RSA-Key existence
stat:
path: /opt/cert/{{item.username}}.key
with_items: “{{roles}}”
register: rsa -
name: debug
debug:
var: item.stat.exists
loop: “{{rsa.results}}” -
name: Generate RSA-Key
community.crypto.openssl_privatekey:
path: /opt/cert/{{item.username}}.key
size: 2048
when: item.stat.exists == False
with_items: -
“{{roles}}”
-
“{{rsa.results}}”
The error that i received - The error was: error while evaluating conditional (item.stat.exists == False): ‘dict object’ has no attribute ‘stat’
Debug task goes just well - “item.stat.exists”: true
I am beating around this about 2 days already… What am i dooing wrong and how to make this work?