ソースを参照

initial updated to ansible dir

master
erin sims 2年前
コミット
bb4e4624ad
4個のファイルの変更57行の追加0行の削除
  1. +2
    -0
      ansible.cfg
  2. +26
    -0
      playbooks/create_droplet.yml
  3. +3
    -0
      playbooks/index.html.j2
  4. +26
    -0
      playbooks/nginx.yml

+ 2
- 0
ansible.cfg ファイルの表示

@@ -0,0 +1,2 @@
[defaults]
host_key_checking = False

+ 26
- 0
playbooks/create_droplet.yml ファイルの表示

@@ -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 }}"

+ 3
- 0
playbooks/index.html.j2 ファイルの表示

@@ -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>

+ 26
- 0
playbooks/nginx.yml ファイルの表示

@@ -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


読み込み中…
キャンセル
保存