Ansible不再工作了

时间:2015-07-28 12:46:52

标签: ubuntu ansible

我已经使用ansible来安装EC2实例,我已经对1.8进行了更新,所以它可以为get_url设置超时参数,现在它已经不能用了。

我有以下securitygroups.yml:

---
# Check security group existence, create them if not existing 

- name: Create security group for ssh
  local_action:
    module: ec2_group
    name: {{ group_name }}
    vpc_id: "{{ vpc_id }}"
    description: Security group for ssh 
    region: "{{ ec2_region }}"
    # inbound rules
    rules:
      - proto: tcp
        from_port: xxx
        to_port: xxx
        cidr_ip: xxx
      - proto: tcp
        from_port: xxx
        to_port: xxx
        cidr_ip: xxx
      - proto: tcp
        from_port: xxx
        to_port: xxx
        cidr_ip: xxx
    # outbound rules
    rules_egress:
      - proto: all
        from_port: xxx
        to_port: xxx
        cidr_ip: xxx


- name: Authorize the members of this group to push logs to the syslog instance. See the syslog group
  local_action:
    module: ec2_group
    name: logstash-shipper
    vpc_id: "{{ vpc_id }}"
    description: Authorize the members of this group to push logs to the syslog instance. See the syslog group
    region: "{{ ec2_region }}"
    # outbound rules
    rules_egress:
      - proto: tcp
        from_port: xxx
        to_port: xxx
        cidr_ip: xxx
      - proto: udp
        from_port: xxx
        to_port: xxx
        cidr_ip: xxx

并在main.yml:

---
# Check security group existence, create them if not existing 

- include: securitygroups.yml
  tags: securitygroups

位于roles/ec2-security-groups/tasks;当然,vars

中有一个main.yml

start.yml是:

- hosts: local
  connection: local
  gather_facts: False
  vars:
    ec2_instance_type: XXX
    instance_tag_name: XXX
    instance_tag_environnement: XXX
    instance_tag_applicatif: XXX
    instance_tag_composant: XXX
    instance_tag_bloc: XXX
  roles:
    - ec2-security-groups

在它工作之前,现在我收到以下错误:

<x.x.x.x> REMOTE_MODULE ec2_group name=XXX vpc_id=XXX region=XXX description='Security group for ssh'
fatal: [localhost -> x.x.x.x] => module ec2_group not found in /usr/share/ansible/cloud:/usr/share/ansible/packaging:/usr/share/ansible/files:/usr/share/ansible/windows:/usr/share/ansible/net_infrastructure:/usr/share/ansible/monitoring:/usr/share/ansible/system:/usr/share/ansible/web_infrastructure:/usr/share/ansible/notification:/usr/share/ansible

FATAL: all hosts have already failed -- aborting

如何解决? (我不知道以前的ansible版本是什么......)

1 个答案:

答案 0 :(得分:0)

修正了它:它应该使用pip安装,并且有效的版本似乎是1.9.1。

sudo pip install ansible==1.9.0.1

我通过阅读this

解决了这个问题