Skip to content
install.yml 2.42 KiB
Newer Older
---

- name: "Import web_app role - EspoCRM"
  import_role:
    name: _web_app

- name: "template {{ rev_proxy }}_app.j2 {{ app_instance_id }}"
  template:
    src: "{{ rev_proxy }}_app.j2"
    dest: "/etc/{{ rev_proxy }}/sites-available/{{ app_instance_id }}.conf"
  when: app_wsgi == "no"
  notify: reload {{ rev_proxy }} web_app
  tags:
    - espocrm_rev_proxy

- name: "cron monthly retrieving slaves backups"
  cron:
    name: "Cron EspoCRM"
    hour: "23"
    minute: "0"
    job: "/usr/bin/php -f {{ app_instance_root }}/cron.php > /dev/null 2>&1"
    user: "{{ app_user }}"

- name: check if {{ app_instance_root }} exists
  stat:
    path: "{{ app_instance_root }}"
  register: "app_root_exist"
  tags: 
    - espocrm_files_rights

- name: attribute correct rights on files
  file:
    state: directory
    path: "{{ item.path }}"
    mode: "{{ item.mode }}"
  tags: 
    - espocrm_files_rights
  when: "app_root_exist.stat.exists"
  loop: "{{ files_rights_directory }}"

- name: "directory and permissions on {{ app_instance_root }}/bin/command"
  file:
    state: file
    path: "{{ app_instance_root }}/bin/command"
    mode: 0754
  tags: 
    - espocrm_files_rights
  when: app_root_exist.stat.exists

- name: check if file /etc/php/{{ php_version }}/fpm/pool.d/php-fpm-{{ app_user }}.conf exists before modifying configuration
  stat:
    path: "/etc/php/{{ php_version }}/fpm/pool.d/php-fpm-{{ app_user }}.conf"
  register: "fpmconf_espo_exist"
  tags:
    - confphpfpm_espocrm

- name : "Delete {{ item.key }} line in /etc/php/{{ php_version }}/fpm/pool.d/php-fpm-{{ app_user }}.conf"
  lineinfile:
      path: "/etc/php/{{ php_version }}/fpm/pool.d/php-fpm-{{ app_user }}.conf"
      regex: '^php_value[{{ item.key }}]'
      state: absent
  loop: "{{ php_params }}"
  tags:
    - confphpfpm_espocrm   
  when: fpmconf_espo_exist.stat.exists

- name: "Configure {{ item.key }}"
  lineinfile:
    line: "php_value[{{ item.key }}] = {{ item.val }}"
    path: "/etc/php/{{ php_version }}/fpm/pool.d/php-fpm-{{ app_user }}.conf"
    state: present
  loop: "{{ php_params }}"
  tags:
    - confphpfpm_espocrm
  when: fpmconf_espo_exist.stat.exists

- name: Print db informations for manual installation 
  vars: 
    msg: |
        db_name: {{ app_instance_id }}_db
        db_user: {{ app_instance_id }}_usr
        db_pass: {{ database_password }}
  debug: 
    msg: "{{ msg.split('\n') }}"       
  tags: debug_db_info
  when: app_run in ['install', 'reinstall']