--- - include_vars: "{{ item }}" with_first_found: - vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml - vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml - vars/{{ ansible_distribution }}.yml - vars/{{ ansible_os_family }}.yml tags: pma - name: Install dependencies yum: name={{ pma_packages }} tags: pma - import_tasks: ../includes/create_system_user.yml vars: - user: "{{ pma_php_user }}" - comment: "PHP FPM for pma {{ pma_id }}" tags: pma - block: - import_tasks: ../includes/webapps_set_install_mode.yml vars: - root_dir: "{{ pma_root_dir }}" - version: "{{ pma_version }}" - set_fact: pma_install_mode={{ (install_mode == 'upgrade' and not pma_manage_upgrade) | ternary('none',install_mode) }} - set_fact: pma_current_version={{ current_version | default('') }} tags: pma - import_tasks: ../includes/webapps_archive.yml vars: - root_dir: "{{ pma_root_dir }}" - version: "{{ pma_current_version }}" - db_name: "{{ pma_db_name }}" when: pma_install_mode == 'upgrade' tags: pma - name: Create directory structure file: path={{ item }} state=directory with_items: - "{{ pma_root_dir }}" - "{{ pma_root_dir }}/web" - "{{ pma_root_dir }}/tmp" - "{{ pma_root_dir }}/sessions" - "{{ pma_root_dir }}/cache" - "{{ pma_root_dir }}/meta" - "{{ pma_root_dir }}/data" tags: pma - name: Download phpMyAdmin get_url: url: "{{ pma_archive_url }}" dest: "{{ pma_root_dir }}/tmp/" checksum: "sha256:{{ pma_archive_sha256 }}" when: pma_install_mode != 'none' tags: pma - name: Extract pma archive unarchive: src: "{{ pma_root_dir }}/tmp/phpMyAdmin-{{ pma_version }}-all-languages.zip" dest: "{{ pma_root_dir }}/tmp" remote_src: yes when: pma_install_mode != 'none' tags: pma - name: Move files to the correct directory synchronize: src: "{{ pma_root_dir }}/tmp/phpMyAdmin-{{ pma_version }}-all-languages/" dest: "{{ pma_root_dir }}/web/" compress: False delete: True delegate_to: "{{ inventory_hostname }}" when: pma_install_mode != 'none' tags: pma - name: Remove temp files file: path={{ item }} state=absent with_items: - "{{ pma_root_dir }}/tmp/phpMyAdmin-{{ pma_version }}-all-languages.zip" - "{{ pma_root_dir }}/tmp/phpMyAdmin-{{ pma_version }}-all-languages" tags: pma - import_tasks: ../includes/get_rand_pass.yml vars: - pass_file: "{{ pma_root_dir }}/meta/key.txt" tags: pma - set_fact: pma_key={{ rand_pass }} tags: pma - import_tasks: ../includes/get_rand_pass.yml vars: - pass_file: "{{pma_root_dir }}/meta/ansible_dbpass" when: pma_db_pass is not defined tags: pma - set_fact: pma_db_pass={{ rand_pass }} when: pma_db_pass is not defined tags: pma - import_tasks: ../includes/webapps_create_mysql_db.yml vars: - db_name: "{{ pma_db_name }}" - db_user: "{{ pma_db_user }}" - db_server: "{{ pma_db_server }}" - db_pass: "{{ pma_db_pass }}" tags: pma - name: Prepare SQL file to create tables replace: path={{ pma_root_dir }}/web/sql/create_tables.sql regexp='phpmyadmin' replace={{ pma_db_name }} tags: pma - name: Create tables mysql_db: name: "{{ pma_db_name }}" state: import target: "{{ pma_root_dir }}/web/sql/create_tables.sql" login_host: "{{ pma_db_server }}" login_user: sqladmin login_password: "{{ mysql_admin_pass }}" when: db_created.changed tags: pma - import_tasks: ../includes/webapps_webconf.yml vars: - app_id: pma_{{ pma_id }} - php_version: "{{ pma_php_version }}" - php_fpm_pool: "{{ pma_php_fpm_pool | default('') }}" tags: pma - name: Deploy sso scripts template: src=sso.php.j2 dest={{ pma_root_dir }}/web/sso.php group={{ pma_php_user }} mode=640 tags: pma - name: Deploy phpMyAdmin config template: src=config.inc.php.j2 dest={{ pma_root_dir }}/web/config.inc.php group={{ pma_php_user }} mode=640 tags: pma - import_tasks: ../includes/webapps_compress_archive.yml vars: - root_dir: "{{ pma_root_dir }}" - version: "{{ pma_current_version }}" when: pma_install_mode == 'upgrade' tags: pma - import_tasks: ../includes/webapps_post.yml vars: - root_dir: "{{ pma_root_dir }}" - version: "{{ pma_version }}" tags: pma