Templated variable inside rulebook is not loaded from vars.yml
alinabuzachis opened this issue · 1 comments
alinabuzachis commented
The "{{ cloudtrail_name }}"
variable is not loaded even if the cloudtrail_name
is defined inside vars.yml and the command used to run the rulebook is:
ansible-rulebook -i ~/dev/inventory-eda.yml --rulebook rulebooks/aws_manage_cloudtrail_encryption.yml --vars vars.yml --verbose
cat rulebooks/aws_manage_cloudtrail_encryption.yml
- name: Rules for cloud.aws_ops to ensure the cloudtrail is encrypted
hosts: all
sources:
- ansible.eda.aws_cloudtrail:
region: 'us-east-1'
delay_seconds: 5
rules:
- name: Enable CreateTrail encryption
condition: event.CloudTrailEvent.eventName=="UpdateTrail" and event.CloudTrailEvent.name == "{{ cloudtrail_name }}" and event.CloudTrailEvent.requestParameters.kmsKeyId==""
action:
run_playbook:
name: playbooks/eda/aws_restore_cloudtrail_encryption.yml
Alex-Izquierdo commented
Jinja substitution is not supported in conditions. Instead you can use vars.cloudtrail_name
https://ansible-rulebook.readthedocs.io/en/latest/variables.html