Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## error
- [root@salt create_vpc]# salt '*' state.apply
- salt.localdomain:
- ----------
- ID: Create subnet
- Function: boto_vpc.subnet_present
- Name: dlab-new-subnet
- Result: True
- Comment: Subnet dlab-new-subnet created.
- Started: 15:52:12.366904
- Duration: 1002.984 ms
- Changes:
- ----------
- new:
- ----------
- subnet:
- ----------
- availability_zone:
- us-east-1e
- cidr_block:
- 10.64.58.0/24
- id:
- subnet-f2bc79ce
- tags:
- ----------
- Name:
- dlab-new-subnet
- vpc_id:
- vpc-fbf8fa9c
- old:
- ----------
- subnet:
- None
- ----------
- ID: Create internet gateway
- Function: boto_vpc.internet_gateway_present
- Name: dlab-new-igw
- Result: True
- Comment: Internet gateway dlab-new-igw created.
- Started: 15:52:13.370038
- Duration: 422.893 ms
- Changes:
- ----------
- new:
- ----------
- internet_gateway:
- igw-2efa2c49
- old:
- ----------
- internet_gateway:
- None
- ----------
- ID: Create route
- Function: boto_vpc.route_table_present
- Name: my_route_table
- Result: False
- Comment: Failed to create route table: Bad Request: The routeTable ID 'rtb-39147c5f' does not exist.
- Started: 15:52:13.793132
- Duration: 446.112 ms
- Changes:
- Summary for salt.localdomain
- ------------
- Succeeded: 2 (changed=2)
- Failed: 1
- ------------
- Total states run: 3
- Total run time: 1.872 s
- rhel_test3:
- Minion did not return. [No response]
- ## latest code
- [root@salt create_vpc]# cat init.sls
- {% set custom_vpc_name = 'dlab-new' %}
- {% set custom_keyid = 'AKIAJUJEVURNZT5IFXNQ' %}
- {% set custom_key = 'JGEZcNhoU9ob/gxIVrZ9XNQFoZEYAdfgpEkQeY7A' %}
- {% set custom_region = 'us-east-1' %}
- {% set cidr_block = '10.64.58.0/24' %}
- {% set instance_id = 'ami-6d1c2007' %}
- # Create a vpc using the execution module
- {% set create_vpc = salt.boto_vpc.create(vpc_name=custom_vpc_name,cidr_block=cidr_block,enable_dns_hostnames=True,region=custom_region,keyid=custom_keyid,key=custom_key) %}
- # Get vpc_id of the previously created vpc using the execution module
- {% set vpc_id = salt.boto_vpc.get_id(name=custom_vpc_name, region=custom_region, keyid=custom_keyid, key=custom_key)['id'] %}
- Create subnet:
- boto_vpc.subnet_present:
- - name: {{ custom_vpc_name }}-subnet
- - vpc_id: {{ vpc_id }}
- - cidr_block: {{ cidr_block }}
- - region: {{ custom_region }}
- - keyid: {{ custom_keyid }}
- - key: {{ custom_key }}
- Create internet gateway:
- boto_vpc.internet_gateway_present:
- - name: {{ custom_vpc_name }}-igw
- - vpc_id: {{ vpc_id }} # I have changed this line from vpc_name into vpc_id, is that what you meant ?
- - keyid: {{ custom_keyid }}
- - key: {{ custom_key }}
- Create route:
- boto_vpc.route_table_present:
- - name: my_route_table
- - vpc_id: {{ vpc_id }}
- - subnet_names:
- - {{ custom_vpc_name }}-subnet
- - region: {{ custom_region }}
- - profile:
- keyid: {{ custom_keyid }}
- key: {{ custom_key }}
Advertisement
Add Comment
Please, Sign In to add comment