[英]exact_count not working in ansible for aws ec2 module
While setting up ec2 instance in AWS the exact_count parameter doesnt seem to be working, from what i understand this needs the count_tag to be present and checks it for duplicate value.在 AWS 中设置 ec2 实例时,exact_count 参数似乎不起作用,据我了解,这需要存在 count_tag 并检查它的重复值。
The current code is below当前代码如下
- name: Creating the EC2 instance
tags: "ec2"
ec2:
key_name: "{{ key_name }}"
image: "{{ image }}"
assign_public_ip: "yes"
instance_tags:
server: ec2-1
vpc_subnet_id: "{{ public_subnet.subnet.id }}"
region: "{{ region }}"
zone: "ap-south-1a"
#security_group: "{{security_group_name}}"
exact_count: 1
count_tag:
Name: "ec2-1"
instance_type: "{{instance_type}}"
aws_access_key: "{{AWSAccessKeyId}}"
aws_secret_key: "{{ AWSSecretKey }}"
register: "ec2"
- debug:
var: ec2
- ec2_instance_info:
filters:
"tag:server": ec2-1
register: "ec2_info"
- debug:
var: ec2_info
Am i missing the concept or the code is wrong?我错过了这个概念还是代码错误?
Never mind: The tags key:value pair was different in definition and execution没关系:标签键:值对在定义和执行上是不同的
name: Creating the EC2 instance名称:创建 EC2 实例
tags: "ec2"
ec2:
key_name: "{{ key_name }}"
image: "{{ image }}"
assign_public_ip: "yes"
instance_tags:
server: ec2-1
vpc_subnet_id: "{{ public_subnet.subnet.id }}"
region: "{{ region }}"
zone: "ap-south-1a"
#security_group: "{{security_group_name}}"
exact_count: 1
count_tag:
server: "ec2-1"
instance_type: "{{instance_type}}"
aws_access_key: "{{AWSAccessKeyId}}"
aws_secret_key: "{{ AWSSecretKey }}"
register: "ec2"
- debug:
var: ec2
- ec2_instance_info:
filters:
"tag:server": ec2-1
register: "ec2_info"
- debug:
var: ec2_info
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.