Your IP : 3.21.205.188


Current Path : /proc/self/root/proc/9788/cwd/etc/ansible/roles/web/tasks/
Upload File :
Current File : //proc/self/root/proc/9788/cwd/etc/ansible/roles/web/tasks/web_composite_configs.yml

---
# create config for composite site
# site_name - name of site (only site kernel or link can be used)
- name: gathering facts about processed site
  delegate_to: "{{ cluster_web_server }}"
  bx_facts: name=list password=0 site={{ web_site_name }} install='(kernel|link)' error=0
  tags: configure_site

- name: create variable with site options
  set_fact:
    bx_sites_info: "{{ hostvars[inventory_hostname]['bx_sites'] }}"
  tags: configure_site

- name: set cluster mark to disabled state
  set_fact:
    is_cluster: "disable"
  tags: configure_site

- name: change cluster mark if web cluster configured
  set_fact:
    is_cluster: "enable"
  when: "cluster_web_configure == 'enable'"
  tags: configure_site

- name: change cluster mark if mysql cluster configured
  set_fact:
    is_cluster: "enable"
  when: "cluster_mysql_configure == 'enable'"
  tags: configure_site

- name: web cluster update for site data
  set_fact:
    web_site_dbserv: "{{ master_server }}"
  tags: configure_site
  when: "is_cluster == 'enable'"

- name: create site map config
  template: src=nginx/nginx_site_map.conf.j2 
    dest=/etc/nginx/bx/maps/{{ item.CompositeNginxID }}.cache_{{ item.SiteName }}.conf
    owner=root group=root mode=0664
  tags: configure_site
  with_items: "{{ bx_sites_info }}"
  when: "manage_web == 'enable_composite' and 'bitrix-web' in group_names"
  notify: restart nginx
  
- name: delete site map config
  file: dest=/etc/nginx/bx/maps/{{ item.CompositeNginxID }}.cache_{{ item.SiteName }}.conf
    state=absent
  tags: configure_site
  with_items: "{{ bx_sites_info }}"
  when: "manage_web == 'disable_composite' and 'bitrix-web' in group_names"
  notify: restart nginx
 
- name: update site http config
  template: src=nginx/http_site_template_composite.conf.j2
    dest={{ item.NginxHTTPDir }}/{{ item.NginxHTTPConfig }}
    owner=root group=root mode=0664
  tags: configure_site
  with_items: "{{ bx_sites_info }}"
  when: "'bitrix-web' in group_names"
  notify: restart nginx
 
- name: update site https config
  template: src=nginx/https_site_template_composite.conf.j2
    dest={{ item.NginxHTTPDir }}/{{ item.NginxHTTPSConfig }}
    owner=root group=root mode=0664
  tags: configure_site
  with_items: "{{ bx_sites_info }}"
  when: "cluster_web_configure != 'enable' and 'bitrix-web' in group_names"
  notify: restart nginx