Hi Community
I wrote the below playbook to fetch an aws secret, but it says syntax error. So can anyone please advise as what might be going wrong ?
Playbook
Hi Community
I wrote the below playbook to fetch an aws secret, but it says syntax error. So can anyone please advise as what might be going wrong ?
Playbook
Remove the single commas on all arguments otherwise they will be literally interpreted as strings.
wild: “{{ lookup(aws_secret=‘DigiCertCA’, bypath=true, region=‘us-east-1’, aws_access_key=‘{{dev_access_key}}’, aws_secret_key=‘{{dev_secret_key}}’ )}}”
Thank you for your response, that too didnt worked out. Got the templating type error
fatal: [localhost]: FAILED! => {
“msg”: “Unexpected templating type error occurred on ({{ lookup(aws_secret=‘DigiCertCA’, bypath=true, region=‘us-east-1’, aws_access_key=‘{{dev_access_key}}’, aws_secret_key=‘{{dev_secret_key}}’ )}}): _lookup() takes at least 2 arguments (1 given)”
}
Playbook
Thank you for your response, that too didnt worked out. Got the templating type error
fatal: [localhost]: FAILED! => {
"msg": "Unexpected templating type error occurred on ({{ lookup(aws_secret='DigiCertCA', bypath=true,
region='us-east-1', aws_access_key='{{dev_access_key}}', aws_secret_key='{{dev_secret_key}}' )}}): _lookup() takes at
least 2 arguments (1 given)"
}
For starters I think "lookup(aws_secret='DigiCertCA'" is incorrect.
I should be lookup('aws_secret', ....)
Regards
Racke
Thank you Stefan for your response.
That also didnt worked. Got the below error. It is a syntax error.
fatal: [localhost]: FAILED! => {
“msg”: “template error while templating string: expected token ‘,’, got ‘=’. String: {{ lookup(‘aws_secret’=DigiCertCA, bypath=true, region=‘us-east-1’, aws_access_key=‘{{dev_access_key}}’, aws_secret_key=‘{{dev_secret_key}}’ )}}”
}
Playbook
Thank you Stefan for your response.
That also didnt worked. Got the below error. It is a syntax error.
fatal: [localhost]: FAILED! => {
"msg": "template error while templating string: expected token ',', got '='. String: {{
lookup('aws_secret'=DigiCertCA, bypath=true, region='us-east-1', aws_access_key='{{dev_access_key}}',
aws_secret_key='{{dev_secret_key}}' )}}"
}
That's no surprise really. Please look up at the examples in the documentation and don't try
to shove random strings to Ansible.
Regards
Racke