簡體   English   中英

在AWS中創建負載均衡器

[英]creating load balancer in AWS

我想創建一個新的負載均衡器並使用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實例的正確方法是什么?

您好像正在創建劇本 劇本實質上是“在這些服務器上執行這些操作”的列表。 但是,您給出的只是一個動作。

您需要的結構更像這樣:

- hosts: localhost
  tasks:
    - name: creating load balancer
      ec2_elb_lb:
        <snip>

你有行動裸列表是你放什么在tasks/main.yaml文件中的一個角色

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM