代码之家  ›  专栏  ›  技术社区  ›  clay

Ansible在EC2上创建标记卷

  •  1
  • clay  · 技术社区  · 7 年前

    在我Ansible剧本中的这段代码中,我在 instance_tags

    在文档中( http://docs.ansible.com/ansible/latest/ec2_module.html ),似乎答案是否定的,但我想在这里问一下以确保。

    tasks:
    - name: EC2 Instance
      ec2:
        aws_access_key: <hidden>
        aws_secret_key: <hidden>
        instance_type: c4.4xlarge
        image: ami-221ea342
        monitoring: yes
        region: us-west-2
        wait: yes
        volumes:
            - device_name: /dev/xvda
              volume_type: gp2
              volume_size: 80
            - device_name: /dev/xvdf
              volume_type: gp2
              volume_size: 500
        exact_count: 2
        count_tag:
          Component: "MyEC2"
          Environment: Production
          <snip>
        instance_tags:
          Component: "MyEC2"
          Environment: Production
          <snip>
    
    2 回复  |  直到 7 年前
        2
  •  1
  •   nmarchini    7 年前

    如果您转而使用Terraform而不是Ansible来创建AWS资源,则可以实现这一点。