|
- ---
- - hosts: localhost
- connection: local
- gather_facts: true
- vars:
- mpdf:
- - 'nyc3-mpdf'
- count: 2
- mpdb:
- - 'nyc3-mpdb'
- tasks:
- - name: create frontend droplets
- digital_ocean_droplet:
- unique_name: yes
- region: nyc3
- image: debian-11-x64
- wait_timeout: 100
- name: "mpdf{{ item }}"
- size_id: s-1vcpu-1gb
- state: present
- oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
- ssh_keys: [ '94:5e:bc:d4:fe:5a:b0:74:7f:06:fc:4e:3d:f7:3e:ea' ] # <---- put your numeric ssh key in here
- tags:
- - 'ansible'
- - 'mpdf'
- register: created_droplets_frontend
- loop: "{{ range(1,count| int + 1) }}"
-
- - name: create backend droplets
- digital_ocean_droplet:
- unique_name: yes
- region: nyc3
- image: debian-11-x64
- wait_timeout: 100
- name: "mpdb{{ item }}"
- size_id: s-1vcpu-1gb
- state: present
- oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
- ssh_keys: [ '94:5e:bc:d4:fe:5a:b0:74:7f:06:fc:4e:3d:f7:3e:ea' ] # <---- put your numeric ssh key in here
- tags:
- - 'ansible'
- - 'mpdb'
- register: created_droplets_backend
- loop: "{{ range(1,count| int + 1) }}"
-
- - name: Create a Firewall named mpdf-firewall
- community.digitalocean.digital_ocean_firewall:
- name: mpdf-firewall
- state: present
- inbound_rules:
- - protocol: "tcp"
- ports: "22"
- sources:
- addresses: ["0.0.0.0/0", "::/0"]
- - protocol: "tcp"
- ports: "6600-6605"
- sources:
- addresses: ["0.0.0.0/0", "::/0"]
- - protocol: "tcp"
- ports: "6700-6705"
- sources:
- tags: ["ansible"]
- addresses: ["0.0.0.0/0", "::/0"]
- outbound_rules:
- - protocol: "tcp"
- ports: "1-65535"
- destinations:
- addresses: ["0.0.0.0/0", "::/0"]
- - protocol: "udp"
- ports: "1-65535"
- destinations:
- addresses: ["0.0.0.0/0", "::/0"]
- - protocol: "icmp"
- ports: "1-65535"
- destinations:
- addresses: ["0.0.0.0/0", "::/0"]
- tags: ["mpdf"]
- - name: Create a Firewall named mpdb-firewall
- community.digitalocean.digital_ocean_firewall:
- name: mpdb-firewall
- state: present
- inbound_rules:
- - protocol: "tcp"
- ports: "22"
- sources:
- addresses: ["0.0.0.0/0", "::/0"]
- - protocol: "tcp"
- ports: "6600"
- sources:
- addresses: ["0.0.0.0/0", "::/0"]
- outbound_rules:
- - protocol: "tcp"
- ports: "1-65535"
- destinations:
- addresses: ["0.0.0.0/0", "::/0"]
- - protocol: "udp"
- ports: "1-65535"
- destinations:
- addresses: ["0.0.0.0/0", "::/0"]
- - protocol: "icmp"
- ports: "1-65535"
- destinations:
- addresses: ["0.0.0.0/0", "::/0"]
- tags: ["mpdb"]
- - name: mpdb
- ansible.builtin.import_playbook: mpdb.yaml
- - name: mpdf
- ansible.builtin.import_playbook: mpdf.yaml
|