main.yml 812 Bytes
---
# tasks file for openresty

# make sure path exist
- stat:
    path:  "{{ path }}"
  register: stat_result
- name: "make sure openresty path exist" 
  fail:
    msg: " openresty {{ path }} not exist!"
  when:  stat_result.stat.exists == False



#  make sure group exists
- name: make sure groups exist in inventory file
  fail:
    msg: "group {{ item }} not exist!"
  when: item not in groups
  with_items:
    - crm-store-nginx
    - java-shops
    - java-portal-gateway
    - java-extendstore
    - java-crm

- name: copy vhosts conf files to openresty
  copy:
    src: vhosts/
    dest: "{{ path }}/nginx/conf/vhosts"
  notify:
    - reload nginx


- name: update nginx upstream for nginx.conf
  template:
    src: nginx.conf.j2
    dest: "{{ path }}/nginx/conf/nginx.conf"
  notify:
    - reload nginx