Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kubespray
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Kubespray
Commits
442d211e
Commit
442d211e
authored
8 years ago
by
Antoine Legrand
Committed by
Antoine Legrand
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add DigitalOcean playbook to create VM
parent
c0aad0a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/cloud_playbooks/create-do.yml
+48
-0
48 additions, 0 deletions
tests/cloud_playbooks/create-do.yml
tests/templates/inventory-do.j2
+48
-0
48 additions, 0 deletions
tests/templates/inventory-do.j2
with
96 additions
and
0 deletions
tests/cloud_playbooks/create-do.yml
0 → 100644
+
48
−
0
View file @
442d211e
---
-
hosts
:
localhost
become
:
false
gather_facts
:
no
vars
:
cloud_machine_type
:
g1-small
mode
:
default
tasks
:
-
name
:
replace_test_id
set_fact
:
test_name
:
"
{{test_id
|regex_replace('
\\
.',
'-')}}"
-
set_fact
:
instance_names
:
>-
{%- if mode in ['separate', 'ha'] -%}
["k8s-{{test_name}}-1", "k8s-{{test_name}}-2", "k8s-{{test_name}}-3"]
{%- else -%}
["k8s-{{test_name}}-1", "k8s-{{test_name}}-2"]
{%- endif -%}
-
name
:
Create DO instances
digital_ocean
:
unique_name
:
yes
api_token
:
"
{{
lookup('env','DO_API_TOKEN')
}}"
command
:
"
droplet"
image_id
:
"
{{
cloud_image
}}"
name
:
"
{{
item
}}"
private_networking
:
no
region_id
:
"
{{cloud_region}}"
size_id
:
2gb
ssh_key_ids
:
"
6536865"
state
:
present
wait
:
yes
register
:
droplets
with_items
:
"
{{instance_names}}"
-
debug
:
msg
:
"
{{droplets}},
{{inventory_path}}"
-
name
:
Template the inventory
template
:
src
:
../templates/inventory-do.j2
dest
:
"
{{
inventory_path
}}/inventory-do.cfg"
-
name
:
Wait for SSH to come up
wait_for
:
host={{item.droplet.ip_address}} port=22 delay=10 timeout=180 state=started
with_items
:
"
{{droplets.results}}"
This diff is collapsed.
Click to expand it.
tests/templates/inventory-do.j2
0 → 100644
+
48
−
0
View file @
442d211e
{% for instance in droplets.results %}
node{{loop.index}} ansible_ssh_host={{instance.droplet.ip_address}}
{% endfor %}
{% if mode is defined and mode == "separate" %}
[kube-master]
node1
[kube-node]
node2
[etcd]
node3
[vault]
node3
{% elif mode is defined and mode == "ha" %}
[kube-master]
node1
node2
[kube-node]
node3
[etcd]
node2
node3
[vault]
node2
node3
{% else %}
[kube-master]
node1
[kube-node]
node2
[etcd]
node1
[vault]
node1
{% endif %}
[k8s-cluster:children]
kube-node
kube-master
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment