main.yml 1.07 KB
---
# 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 vaviable [nameserver] exist
- name: "make sure variable [nameservers] exists"
  fail: 
    msg: "variable [nameservers] not exist "
  when: nameservers == ''


#  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:
    - java-nginx
    - java-gateway
    - java-brower
    - java-wechat
    - java-activity
    - java-erpgateway
    - java-union

- name: copy lualib files to openresty
  copy:
    src: lualib/resty/
    dest: "{{ path }}/lualib/resty/"



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


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