@@ -0,0 +1,2 @@ | |||||
[defaults] | |||||
host_key_checking = False |
@@ -0,0 +1,26 @@ | |||||
--- | |||||
- hosts: localhost | |||||
connection: local | |||||
gather_facts: false | |||||
tasks: | |||||
- name: create two droplets | |||||
digital_ocean_droplet: | |||||
unique_name: yes | |||||
region: ams3 | |||||
image: ubuntu-18-10-x64 | |||||
wait_timeout: 100 | |||||
name: "{{ item }}" | |||||
size_id: s-1vcpu-1gb | |||||
state: present | |||||
ssh_keys: [ '1' ] # <---- put your numeric ssh key in here | |||||
register: created_droplets | |||||
with_items: | |||||
- tmp-droplet-1 | |||||
- tmp-droplet-2 | |||||
- name: add to dynamic inventory | |||||
add_host: | |||||
name: "{{ item.data.ip_address }}" | |||||
group: do | |||||
with_items: "{{ created_droplets.results }}" |
@@ -0,0 +1,3 @@ | |||||
<h1> On a digital ocean droplet now </h1> | |||||
<p> The ip address where we're at is: {{ ansible_default_ipv4.address }} </p> |
@@ -0,0 +1,26 @@ | |||||
- hosts: do | |||||
remote_user: root | |||||
gather_facts: false | |||||
vars: | |||||
ansible_python_interpreter: /usr/bin/python3 | |||||
tasks: | |||||
- name: wait for port 22 to become available | |||||
wait_for: | |||||
host: "{{ inventory_hostname }}" | |||||
port: 22 | |||||
delegate_to: localhost | |||||
- name: Gather Facts | |||||
setup: | |||||
- name: install nginx | |||||
apt: | |||||
name: nginx | |||||
- name: modify html file | |||||
template: | |||||
src: ./index.html.j2 | |||||
dest: /var/www/html/index.html | |||||