summaryrefslogtreecommitdiff
path: root/test/integration/targets/ec2_group/tasks/numeric_protos.yml
blob: ba4f7e90dc533b651e7ee0e667d8282e2f04d0b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
- block:
    - name: set up aws connection info
      set_fact:
        group_tmp_name: '{{ec2_group_name}}-numbered-protos'
        aws_connection_info: &aws_connection_info
          aws_access_key: "{{ aws_access_key }}"
          aws_secret_key: "{{ aws_secret_key }}"
          security_token: "{{ security_token }}"
          region: "{{ aws_region }}"
      no_log: yes

    - name: Create a group with numbered protocol (GRE)
      ec2_group:
        name: '{{ group_tmp_name }}'
        vpc_id: '{{ vpc_result.vpc.id }}'
        description: '{{ ec2_group_description }}'
        rules:
        - proto: 47
          to_port: -1
          from_port: -1
          cidr_ip: 0.0.0.0/0
        <<: *aws_connection_info
        state: present
      register: result

    - name: Create a group with a quoted proto
      ec2_group:
        name: '{{ group_tmp_name }}'
        vpc_id: '{{ vpc_result.vpc.id }}'
        description: '{{ ec2_group_description }}'
        rules:
        - proto: '47'
          to_port: -1
          from_port: -1
          cidr_ip: 0.0.0.0/0
        <<: *aws_connection_info
        state: present
      register: result
    - assert:
        that:
          - result is not changed
    - name: Add a tag with a numeric value
      ec2_group:
        name: '{{ group_tmp_name }}'
        vpc_id: '{{ vpc_result.vpc.id }}'
        description: '{{ ec2_group_description }}'
        tags:
          foo: 1
        <<: *aws_connection_info
    - name: Read a tag with a numeric value
      ec2_group:
        name: '{{ group_tmp_name }}'
        vpc_id: '{{ vpc_result.vpc.id }}'
        description: '{{ ec2_group_description }}'
        tags:
          foo: 1
        <<: *aws_connection_info
      register: result
    - assert:
        that:
          - result is not changed

  always:
    - name: tidy up egress rule test security group
      ec2_group:
        name: '{{group_tmp_name}}'
        state: absent
        vpc_id: '{{ vpc_result.vpc.id }}'
        <<: *aws_connection_info
      ignore_errors: yes