Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
mysql_root_password: "{{ vault_mysql_root_password }}" # Define this variable in group_vars/staging/vault.yml | ||
sudoer_passwords: "{{ vault_sudoer_passwords }}" # Define this variable in group_vars/staging/vault.yml | ||
|
||
do_api_token: "{{ vault_do_key }}" | ||
do_ssh_key: https://github.com/username.keys | ||
do_saved_ssh_key: ~/.ssh/do_id_rsa.pub | ||
droplets: | ||
web-1: | ||
do_size: 512mb | ||
do_region: nyc2 | ||
do_image: ubuntu-14-04-x64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: "Create server infrastructure on digitalocean.com" | ||
|
||
hosts: digital_ocean | ||
|
||
roles: | ||
- digitalocean | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
do_api_token: "{{ vault_do_key }}" | ||
ssh_key: ~/.ssh/id_rsa.pub | ||
saved_ssh_key: ~/.ssh/do_id_rsa.pub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
- name: Load SSH Public Key | ||
get_url: url={{ do_ssh_key }} dest={{ do_saved_ssh_key }} | ||
|
||
- name: Ensure SSH Key Exists at DigitalOcean | ||
digital_ocean: > | ||
state=present | ||
command=ssh | ||
name=roots_provisioner | ||
ssh_pub_key={{ lookup('file', '{{ do_saved_ssh_key }}' ) }} | ||
api_token={{ do_api_token }} | ||
register: roots_provisioner | ||
|
||
- name: Ensure Droplet Exists | ||
digital_ocean: > | ||
state=present | ||
command=droplet | ||
name={{ item.key }} | ||
unique_name=yes | ||
size_id={{ item.value.do_size }} | ||
region_id={{ item.value.do_region }} | ||
image_id={{ item.value.do_image }} | ||
ssh_key_ids={{ roots_provisioner.ssh_key.id }} | ||
api_token={{ do_api_token }} | ||
with_dict: droplets | ||
register: new_droplets | ||
|
||
- debug: msg="IP is {{ item.droplet.ip_address }}" | ||
with_items: new_droplets.results |