This repository has been archived by the owner on May 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathdo_cluster.yml
42 lines (38 loc) · 1.73 KB
/
do_cluster.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
- hosts: localhost
gather_facts: False
tasks:
- name: create DigitalOcean SSH key
digital_ocean: >
command=ssh
name=travisci
ssh_pub_key='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD1J3LsiGCDBPqwdnDyDHif7DnusJvTCydtg6cT0414J+8+jssgrxSzdM8da7V+CjFssD3X8KUM2SrSOoVEKq7ZJ1KGnGapKKmiW2oZ8Ndy5y3Xox7mP1kLYoFEunjy4zOe6kftiI/rKytEBjFCbkqtVa/giF9j5u/GeKcZAsEMHa2UqFe6w6n+MNkqCZzaPBBXlI+9gXdWXVv3d74rdHh0i24zVr+MjelFXetOLUGHOiyr29DQ5wd/V5GHCyZ/7nBNS0GszVDX8XWbwHjdFZ1Oaqswu+okZCSN2SrTXIF2YMWK7tupmSNagUVa9xPZrs8GEC64AZeXNQh/UJO+TzRn [email protected]'
client_id={{ client_id }}
api_key={{ api_key_password }}
register: traviscikey
- name: create DigitalOcean droplets to deploy cluster on (1 monitor + 2 master + 4 slave droplets)
digital_ocean: >
name={{ item }}
ssh_key_ids="{{ traviscikey.ssh_key.id }}"
client_id={{ client_id }}
api_key={{ api_key_password }}
size_id=62
region_id=4
image_id=3101918
register: hosts
with_items:
- monitor01
- hmaster01
- hmaster02
- hslave01
- hslave02
- hslave03
- hslave04
- name: add delete line to /etc/rc6.d/K10do_destroy.sh
sudo: true
lineinfile: create=yes dest=/etc/rc6.d/K10do_destroy.sh line="wget -qO- https://api.digitalocean.com/droplets/{{ item.droplet.id }}/destroy/\?client_id\={{ client_id }}\&api_key\={{ api_key_password }}" owner=root group=root mode=755
with_items: hosts.results
- name: add the newly created hosts to /etc/hosts
sudo: true
lineinfile: dest=/etc/hosts line="{{ item.droplet.ip_address }} {{ item.droplet.name }}"
with_items: hosts.results