-1
を私がプレイしながら、次のエラーを取得する:Terminate instances
が実行されます。エラーEC2インスタンスを終了している間:Ansible
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Either region or ec2_url must be specified"}
は、これが私の脚本です:
- hosts: localhost
connection: local
remote_user: test
gather_facts: no
vars_files:
- files/aws_creds.yml
- files/info.yml
tasks:
- name: Basic provisioning of EC2 instance
ec2:
assign_public_ip: no
aws_access_key: "{{ aws_id }}"
aws_secret_key: "{{ aws_key }}"
region: "{{ aws_region }}"
image: "{{ standard_ami }}"
instance_type: "{{ free_instance }}"
key_name: "{{ ssh_keyname }}"
count: 3
state: present
group_id: "{{ secgroup_id }}"
wait: no
#delete_on_termination: yes
instance_tags:
Name: Dawny33Template
register: ec2
- name: Add new instance to host group
add_host:
hostname: "{{ item.public_ip }}"
groupname: launched
with_items: "{{ ec2.instances }}"
## Here lies the SSH code
- name: Wait for SSH to come up
wait_for:
host: "{{ item.public_ip }}"
port: 22
delay: 60
timeout: 320
state: started
with_items: "{{ ec2.instances }}"
- name: Configure instance(s)
hosts: launched
become: True
gather_facts: True
#roles:
# - my_awesome_role
# - my_awesome_test
tasks:
- name: install git
yum: name=git state=present
- name: check out a git repository
git: repo={{ repo_url }} dest=/Dest/To/Repo/ accept_hostkey=yes
vars:
repo_url: https://github.com/lorin/mezzanine-example.git
- name: Terminate instances
hosts: localhost
connection: local
tasks:
- name: Terminate instances that were previously launched
ec2:
state: 'absent'
instance_ids: '{{ ec2.instance_ids }}'
エラーが本当に意味ありませんか?そして、どうすればそれを解決できますか?
あなたは終了EC2タスク –
@BenWhaley I領域を指定する必要があります...あなたはインスタンスを起動し、最後のプレーで任意のVARSファイルを定義していない最初のプレイに
aws_creds.yml
含ま見ますinstance_ids行の下に 'region: 'us-west-2''を追加しました。このエラーは、 'fatal:[localhost]:FAILED! "HmacAuthV4Handler ']あなたの証明書を確認してください"} ':/ – Dawny33