Create various resources on the Digital Ocean platform.
- You must have a Digital Ocean API key.
- The Digital Ocean API must be accessible.
Available variables are listed below, along with default values (see defaults/main.yml
).
digitalocean_api_token: '1234567890abscdefg'
Your Digital Ocean API token.
digitalocean_projects:
- name: 'MYPROJECT'
purpose: 'Website or blog'
description: 'My project'
environment: 'Development'
- name: 'OTHERPROJECT'
An array of Digital Ocean projects to create with the following items:
- name: The project name.
- purpose: Optional. The project purpose, must be a valid purpose type.
- description: Optional. The project description.
- environment: Optional. The Digtial Ocean envionment, must be
Produciton
,Staging
, orDevelopment
.
digitalocean_clusters:
- name: "my-k8s"
region: "sfo2"
version: "1.13.2-do.1"
tags:
- "live"
node_pools:
- name: "default-pool"
size: "s-1vcpu-2gb"
count: 3
An array of Kubernetes clusters to create on Digital Ocean, each item representing a single cluster.
- name: The name of the cluster.
- region: The Digital Ocean region slugline in which to create the cluster.
- version: Optional. The Digital Ocean slugline of the Kubernetes version to use.
- tags: Optional. An array of tags to apply to the cluster.
- node_pools: Optional. The node pools to add to the cluster. If not specified, a default pool of 3 of the smallest node sizes available.
This role can also apply k8s labels to a Digital Ocean node pool:
digitalocean_clusters:
- name: "my-k8s"
region: "sfo2"
version: "1.13.2-do.1"
tags:
- "live"
node_pools:
- name: "default-pool"
size: "s-1vcpu-2gb"
count: 3
labels:
- key: "app"
value: "web"
By default, this role will create new node pools, and update existing node pools as they are described under digitalocean_clusters.node_pools
. You can also be explicit by specifying the state
item:
digitalocean_clusters:
- name: "my-k8s"
region: "sfo2"
version: "1.13.2-do.1"
tags:
- "live"
node_pools:
- name: "default-pool"
state: present
size: "s-1vcpu-2gb"
count: 3
labels:
- key: "app"
value: "web"
This role will also delete node pools listed with a state
of absent
:
digitalocean_clusters:
- name: "my-k8s"
region: "sfo2"
version: "1.13.2-do.1"
tags:
- "live"
node_pools:
- name: "default-pool"
state: present
size: "s-1vcpu-2gb"
count: 3
labels:
- key: "app"
value: "web"
- name: "ye-olde-pool"
state: absent
None, but the following roles are recommended:
- All requirements for the k8s module.
---
- hosts: servers
vars:
digitalocean_api_token: '1234567890abscdefg'
digitalocean_projects:
- name: 'MYPROJECT'
digitalocean_clusters:
- name: "my-k8s"
region: "sfo2"
version: "1.13.2-do.1"
tags:
- "live"
node_pools:
- name: "default-pool"
state: present
size: "s-1vcpu-2gb"
count: 3
roles:
- socketwench.digitalocean
GPL v3
This role was created by socketwench for TEN7.