Ansible is not working anymore

2019-08-30 02:32发布

I have used ansible for mounting EC2 instances, I have done an update to 1.8, so it can have the timeout parameter for get_url, and now it is not working anymore.

I have the following 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

and in main.yml:

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

- include: securitygroups.yml
  tags: securitygroups

that is in roles/ec2-security-groups/tasks; ofcourse there is a main.yml in vars

The start.yml is:

- 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

Before it worked, now I get the following error:

<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

How to fix it? (I don't know what the ansible version before was...)

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-30 03:13

Fixed it: It should be installed using pip and the version that works seems to be the 1.9.1.

sudo pip install ansible==1.9.0.1

I have solved this by reading this

查看更多
登录 后发表回答