2016-02-10 18:51:39 +08:00
|
|
|
---
|
|
|
|
- hosts: localhost
|
2019-04-18 16:42:10 +08:00
|
|
|
become: False
|
2016-02-10 18:51:39 +08:00
|
|
|
gather_facts: False
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Provision a set of instances
|
2023-06-26 18:15:45 +08:00
|
|
|
amazon.aws.ec2_instance:
|
2016-02-10 18:51:39 +08:00
|
|
|
key_name: "{{ aws.key_name }}"
|
|
|
|
aws_access_key: "{{ aws.access_key }}"
|
|
|
|
aws_secret_key: "{{ aws.secret_key }}"
|
|
|
|
region: "{{ aws.region }}"
|
2019-05-03 05:24:21 +08:00
|
|
|
group_id: "{{ aws.group }}"
|
|
|
|
instance_type: "{{ aws.instance_type }}"
|
2016-02-10 18:51:39 +08:00
|
|
|
image: "{{ aws.ami_id }}"
|
|
|
|
wait: true
|
|
|
|
count: "{{ aws.count }}"
|
|
|
|
instance_tags: "{{ aws.tags }}"
|
|
|
|
register: ec2
|
|
|
|
|
2020-07-28 16:21:08 +08:00
|
|
|
- name: Template the inventory
|
2016-02-10 18:51:39 +08:00
|
|
|
template:
|
2020-07-28 16:21:08 +08:00
|
|
|
src: ../templates/inventory-aws.j2 # noqa 404 CI inventory templates are not in role_path
|
2016-02-10 18:51:39 +08:00
|
|
|
dest: "{{ inventory_path }}"
|
2021-07-12 15:00:47 +08:00
|
|
|
mode: 0644
|