forked from evolix/ansible-roles
split amazon-ec2 tasks (cherry-pick)
This commit is contained in:
parent
ad9a15827f
commit
4601dae563
|
@ -14,6 +14,7 @@ machine and an Amazon security access key pair created for your account.
|
||||||
|
|
||||||
By default, this role does nothing (no `main.yml` file).
|
By default, this role does nothing (no `main.yml` file).
|
||||||
|
|
||||||
|
* `setup.yml`: create a security group and ssh keys
|
||||||
* `create-instance.yml`: create new EC2 instances
|
* `create-instance.yml`: create new EC2 instances
|
||||||
* `post-install.yml`: remove admin user created on Debian instances
|
* `post-install.yml`: remove admin user created on Debian instances
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
aws_region: ca-central-1
|
aws_region: ca-central-1
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- include_role:
|
||||||
|
name: amazon-ec2
|
||||||
|
tasks_from: setup.yml
|
||||||
- include_role:
|
- include_role:
|
||||||
name: amazon-ec2
|
name: amazon-ec2
|
||||||
tasks_from: create-instance.yml
|
tasks_from: create-instance.yml
|
||||||
|
|
|
@ -1,24 +1,4 @@
|
||||||
---
|
---
|
||||||
- name: Create default security group
|
|
||||||
ec2_group:
|
|
||||||
name: "{{ec2_security_group.name}}"
|
|
||||||
state: present
|
|
||||||
aws_access_key: "{{aws_access_key}}"
|
|
||||||
aws_secret_key: "{{aws_secret_key}}"
|
|
||||||
region: "{{aws_region}}"
|
|
||||||
description: "{{ec2_security_group.description}}"
|
|
||||||
rules: "{{ec2_security_group.rules}}"
|
|
||||||
rules_egress: "{{ec2_security_group.rules_egress}}"
|
|
||||||
|
|
||||||
- name: Create key pair
|
|
||||||
ec2_key:
|
|
||||||
name: "{{ec2_keyname}}"
|
|
||||||
state: present
|
|
||||||
aws_access_key: "{{aws_access_key}}"
|
|
||||||
aws_secret_key: "{{aws_secret_key}}"
|
|
||||||
region: "{{aws_region}}"
|
|
||||||
key_material: "{{item}}"
|
|
||||||
with_file: "{{ssh_pubkey_file}}"
|
|
||||||
|
|
||||||
- name: Launch new instance(s)
|
- name: Launch new instance(s)
|
||||||
ec2:
|
ec2:
|
||||||
|
|
22
amazon-ec2/tasks/setup.yml
Normal file
22
amazon-ec2/tasks/setup.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Create default security group
|
||||||
|
ec2_group:
|
||||||
|
name: "{{ec2_security_group.name}}"
|
||||||
|
state: present
|
||||||
|
aws_access_key: "{{aws_access_key}}"
|
||||||
|
aws_secret_key: "{{aws_secret_key}}"
|
||||||
|
region: "{{aws_region}}"
|
||||||
|
description: "{{ec2_security_group.description}}"
|
||||||
|
rules: "{{ec2_security_group.rules}}"
|
||||||
|
rules_egress: "{{ec2_security_group.rules_egress}}"
|
||||||
|
|
||||||
|
- name: Create key pair
|
||||||
|
ec2_key:
|
||||||
|
name: "{{ec2_keyname}}"
|
||||||
|
state: present
|
||||||
|
aws_access_key: "{{aws_access_key}}"
|
||||||
|
aws_secret_key: "{{aws_secret_key}}"
|
||||||
|
region: "{{aws_region}}"
|
||||||
|
key_material: "{{item}}"
|
||||||
|
with_file: "{{ssh_pubkey_file}}"
|
Loading…
Reference in a new issue