【发布时间】:2020-02-16 12:58:36
【问题描述】:
---
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Create a security group
ec2_group:
- name: Ansible
description: Ansible security group
region: us-east-1
rules:
- proto: tcp
from_port: 80
to_port: 80
cidr_ip: 0.0.0.0/0
- proto: tcp
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
当我运行此剧本时,我收到以下错误
[root]#ansible-playbook aws1.yaml 错误!意外的参数类型在起作用:
错误似乎在“/root/Desktop/ansible_pro/aws/1/aws1.yaml”中:第 6 行第 7 列,但可能 根据确切的语法问题,位于文件中的其他位置。
违规行似乎是:
tasks:
- name: Create a security group
^ here
我是 aws 和 ansible 的新手。请帮忙
【问题讨论】:
-
您的剧本无效。修理它。
ec2_group因为任何其他模块都期望 dict 键作为参数,而不是列表。至少,您可以查看模块文档中的示例。
标签: amazon-ec2 ansible