【发布时间】:2019-02-07 15:55:23
【问题描述】:
我想创建一个新的负载均衡器并使用 ansible 在 aws 中分配一个 ec2 实例。所以,我创建了 new_elb.yml 文件来创建新的 elb,下面是我的 ELB 代码:
---
#tasks:
- name: creating load balancer
#local_action:
ec2_elb_lb:
name: "apache-balancer"
state: present
zones:
- us-west-2a
- us-west-2b
listeners:
- protocol: http
load_balancer_port: 80
instance_port: 443
~
我收到如下错误:
ERROR! 'ec2_elb_lb' is not a valid attribute for a Play
The error appears to have been in '/etc/ansible/playbooks/final_elb.yml': line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
#tasks:
- name: creating load balancer
^ here
谁能告诉我使用ansible声明ELB和注册ec2实例的正确方法是什么?
【问题讨论】:
-
如果您使用角色方法并创建顶级剧本来调用此角色。然后代码应该可以工作。只需确保“local_action”不存在。
标签: ansible ansible-playbook amazon-elb ansible-2.x