ホスト(ec2-test)のプレイ中に、下にある(2.1.1.0)以下のプレイブックがスキップしています。アシスタントホストファイルには、新たに作成されたインスタンスのfqdnが追加されています。私のプレイブックをもう一度走らせるとうまくいく。しかし、実行中の1回目は、どのホストにマッチしたエラーを:(投げない「スキップする:ホストが一致していません」という可能性のあるプレイブッブ
私の脚本:マッチしていないホスト:
---
- name: Provision an EC2 instance
hosts: localhost
connection: local
gather_facts: no
become: False
vars_files:
- awsdetails.yml
tasks:
- name: Launch the new EC2 Instance
ec2:
aws_access_key: "{{ aws_id }}"
aws_secret_key: "{{ aws_key }}"
group_id: "{{ security_group_id }}"
instance_type: "{{ instance_type }}"
image: "{{ image }}"
key_name: "{{ ssh_keyname }}"
wait: yes
region: "{{ region }}"
count: 1
register: ec2
- name: Update the ansible hosts file with new IP address
local_action: lineinfile dest="/etc/ansible/hosts" regexp={{ item.dns_name }} insertafter='\[ec2-test\]'line="{{item.dns_name}} ansible_ssh_private_key_file=/etc/ansible/e2-key-file.pem ansible_user=ec2-user"
with_items: ec2.instances
- name: Wait for SSH to come up
wait_for: host={{ item.public_dns_name }} port=22 delay=60 timeout=320 state=started
with_items: ec2.instances
- name: playing ec2-test instances
hosts: ec2-test
gather_facts: no
私のhostsファイルは、これらの棚卸
[localhost]
localhost
....
[ec2-test]
ec2-54-244-180-186.us-west-2.compute.amazonaws.com
私はスキップを取得していますなぜすべてのアイデアを持っていますここに表示されるとエラーが発生しますか?ご協力いただければ幸いです。
ありがとうございます!