Переглянути джерело

leo los host nginx de archivo externo

David 10 роки тому
батько
коміт
4846a8e6c2

+ 4 - 0
nginx_hosts.yml

@@ -0,0 +1,4 @@
+nginx_hosts:
+  - 198.211.98.41
+  - 67.205.137.99
+

+ 0 - 4
roles/create-droplet/tasks/main.yml

@@ -8,13 +8,9 @@
     region_id=nyc1
     image_id=debian-8-x64
     ssh_key_ids={{ desktap.ssh_key.id }}
-    private_networking=yes
   with_items: "{{ droplets }}"
   register: droplet_details
 
-  #- debug: msg="IP is {{ item['droplet']['ip_address'] }}, ID is {{ item['droplet']['id']}}."
-  #  with_items: "{{ droplet_details.results }}"
-
 - name: Save IP/ID/Group to file
   local_action: copy content="{{ item['droplet']['ip_address'] }}" dest="/tmp/outfile{{item['droplet']['name']}}"
   with_items: "{{ droplet_details.results }}"

+ 5 - 4
roles/ufw_user/tasks/main.yml

@@ -7,11 +7,12 @@
 - name: Allow (limit) ssh
   ufw: rule=limit port=22 proto=tcp
 
-- name: Allow backend access (fixme local?)
+- name: Include nginx hosts
+  include_vars: nginx_hosts.yml
+
+- name: Allow nginx to access the backend
   ufw: rule=allow port=8000:8100 proto=tcp from="{{item}}"
-  with_items:
-    - 198.199.89.228
-    - 198.211.98.40
+  with_items: "{{nginx_hosts}}"
 
 - name: Enable ufw
   ufw: state=enabled