Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Interesting Uses of Ansible's ternary filter.
aws_tags_pio: RoleImage: "pio"
aws_tags_role_app_tpl: [ { Role: "app" }, "{{ (mageops_pio_worker_enable and not mageops_pio_worker_dedicated_asg) | ternary(aws_tags_pio, {}) }}" ]
aws_tags_role_app: "{{ aws_tags_role_app_tpl | combine }}"
https://github.com/mageops/ansible-infrastructure/blob/5dcc3...
for array you use flatten eg
aws_security_group_persistant_rules_tpl: [ "{{ mageops_ssh_proxy_persistant | ternary(aws_security_group_persistant_rules_ssh_proxy, []) }}", "{{ mageops_tinyproxy_persistant_enabled | ternary(aws_security_group_persistent_rules_tinyproxy, []) }}" ]
aws_security_group_persistant_rules: "{{ aws_security_group_persistant_rules_tpl | flatten }}"
this pattern really helped to clean up conditionals that normally had to be done in tasks
There are no comments on this comment yet.
aws_tags_pio: RoleImage: "pio"
aws_tags_role_app_tpl: [ { Role: "app" }, "{{ (mageops_pio_worker_enable and not mageops_pio_worker_dedicated_asg) | ternary(aws_tags_pio, {}) }}" ]
aws_tags_role_app: "{{ aws_tags_role_app_tpl | combine }}"
https://github.com/mageops/ansible-infrastructure/blob/5dcc3...
for array you use flatten eg
aws_security_group_persistant_rules_tpl: [ "{{ mageops_ssh_proxy_persistant | ternary(aws_security_group_persistant_rules_ssh_proxy, []) }}", "{{ mageops_tinyproxy_persistant_enabled | ternary(aws_security_group_persistent_rules_tinyproxy, []) }}" ]
aws_security_group_persistant_rules: "{{ aws_security_group_persistant_rules_tpl | flatten }}"
this pattern really helped to clean up conditionals that normally had to be done in tasks