oliverdavies.uk-drupal-old/tools/ansible/digitalocean.yml

28 lines
806 B
YAML

---
- hosts: localhost
gather_facts: False
vars_files:
- ./vars/digitalocean_vault.yml
- ./vars/digitalocean_vars.yml
vars:
droplets:
- { name: "oliverdavies-uk-web2", group: "oliverdavies-uk" }
- { name: "oliverdavies-uk-db", group: "oliverdavies-uk" }
tasks:
- name: Provision DigitalOcean droplets
digital_ocean_droplet:
state: "{{ item.state | default('present') }}"
name: "{{ item.name }}"
oauth_token: "{{ digitalocean_api_key }}"
size: "{{ item.size | default('1gb') }}"
region: "{{ item.region | default('lon1') }}"
image: "{{ item.image | default('ubuntu-20-04-x64') }}"
unique_name: yes
ssh_keys:
- 28701873
register: created_droplets
with_items: "{{ droplets }}"