Skip to content

Instantly share code, notes, and snippets.

@bradleypettit
Created November 3, 2020 00:06
Show Gist options
  • Save bradleypettit/351d5a1c576eba826bbafd2f016550c9 to your computer and use it in GitHub Desktop.
Save bradleypettit/351d5a1c576eba826bbafd2f016550c9 to your computer and use it in GitHub Desktop.
Playbook to reproduce issue with ALB rules identified in ansible-collections/amazon.aws/issue/187
---
- hosts: localhost
vars:
security_grps:
- sg-group #masked
subnets:
- subnet-a #masked
- subnet-b #masked
- subnet-c #masked
tasks:
- name: ALB Rule - http-header
community.aws.elb_application_lb:
name: test-alb-httpheader
state: present
security_groups: "{{ security_grps }}"
subnets: "{{ subnets }}"
listeners:
- Protocol: HTTP
Port: 80
DefaultActions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
Rules:
- Conditions:
- Field: http-header
HttpHeaderConfig:
HttpHeaderName: header-key
Values:
- 'header-value-1'
Priority: '1'
Actions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
ignore_errors: true
loop: "{{ range(0,2)|list }}"
- name: ALB Rule - http-request-method
community.aws.elb_application_lb:
name: test-alb-httprequestmethod
state: present
security_groups: "{{ security_grps }}"
subnets: "{{ subnets }}"
listeners:
- Protocol: HTTP
Port: 80
DefaultActions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
Rules:
- Conditions:
- Field: http-request-method
HttpRequestMethodConfig:
Values:
- 'GET'
Priority: '1'
Actions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
ignore_errors: true
loop: "{{ range(0,2)|list }}"
- name: ALB Rule - host-header
community.aws.elb_application_lb:
name: test-alb-hostheader
state: present
security_groups: "{{ security_grps }}"
subnets: "{{ subnets }}"
listeners:
- Protocol: HTTP
Port: 80
DefaultActions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
Rules:
- Conditions:
- Field: host-header
HostHeaderConfig:
Values:
- 'host.1'
Priority: '1'
Actions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
ignore_errors: true
loop: "{{ range(0,2)|list }}"
- name: ALB Rule - path-pattern
community.aws.elb_application_lb:
name: test-alb-pathpattern
state: present
security_groups: "{{ security_grps }}"
subnets: "{{ subnets }}"
listeners:
- Protocol: HTTP
Port: 80
DefaultActions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
Rules:
- Conditions:
- Field: path-pattern
PathPatternConfig:
Values:
- 'pattern1'
Priority: '1'
Actions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
ignore_errors: true
loop: "{{ range(0,2)|list }}"
- name: ALB Rule - query-string
community.aws.elb_application_lb:
name: test-alb-querystring
state: present
security_groups: "{{ security_grps }}"
subnets: "{{ subnets }}"
listeners:
- Protocol: HTTP
Port: 80
DefaultActions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
Rules:
- Conditions:
- Field: query-string
QueryStringConfig:
Values:
- Key: 'key1'
Value: 'value1'
Priority: '1'
Actions:
- Type: fixed-response
FixedResponseConfig:
StatusCode: "200"
ignore_errors: true
loop: "{{ range(0,2)|list }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment