【发布时间】:2016-01-20 17:09:48
【问题描述】:
我是 Ansible(或与此相关的任何脚本语言)的完全 n00b 并且希望对我的语法/缩进 (?) 问题提供一些帮助。
这是我的简单剧本,目标是在 AWS 中创建一个实例并将其添加到安全组。
我很困惑问题出在哪里,因为我从不同的 yaml 检查器收到 2 个不同的错误:
1) Yamllint 告诉我:“(): 在解析第 2 行第 3 列的块映射时没有找到预期的键”
2) Swagger 告诉我:“YAML 语法错误。第 6 行第 3 列的序列条目缩进错误:-名称:创建安全组 ^”(指向第二个“-名称”)
任何帮助都会很棒~
干杯~
---
- name: Provision an EC2 Instance and assign an SG
hosts: local
connection: local
gather_facts: False
- name: Create a security group
local_action:
module: ec2_group
name: test_sg
region: us-west-2
rules:
- proto: tcp
type: ssh
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
- proto: tcp
from_port: 80
to_port: 80
cidr_ip: 0.0.0.0/0
rules_egress:
- proto: all
type: all
cidr_ip: 0.0.0.0/0
- name: Create new instance
local_action: ec2
group= test_sg
instance_type= t1.micro
image= ami-9ff7e8af
wait= true
region= us-west-2
keypair= XXX-keypair
count= 1
register: ec2
【问题讨论】:
标签: amazon-web-services amazon-ec2 yaml ansible ansible-playbook