---
- name: "check ngx_http_waf_module"
  stat:
    path: "{{ OS.nginx.dirs.conf }}/modules/ngx_http_waf_module.so"
  register: waf_module

- name: "install ngx_http_waf_module"
  copy:
    src: redhat_ngx_http_waf_module.so
    dest: "{{ OS.nginx.dirs.conf }}/modules/ngx_http_waf_module.so"
    mode: 0644
  when: not waf_module.stat.exists

- name: "check librabbitmq"
  stat:
    path: "{{ OS.libs }}/librabbitmq.so.4.3.0"
  register: rabbitmq_module

- name: "install librabbitmq"
  copy:
    src: librabbitmq.so.4.3.0
    dest: "{{ OS.libs }}/librabbitmq.so.4.3.0"
    mode: 0644
  when: not rabbitmq_module.stat.exists

- name: "create link librabbitmq.so.4.3.0 => librabbitmq.so.4"
  file:
    src: "{{ OS.libs }}/librabbitmq.so.4.3.0"
    dest: "{{ OS.libs }}/librabbitmq.so.4"
    mode: "0755"
    owner: root
    group: root
    state: link
  when: not rabbitmq_module.stat.exists
