mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-26 15:55:56 +02:00
Update to 2021-12-01 19:13
This commit is contained in:
8
roles/phpmyadmin/tasks/archive_post.yml
Normal file
8
roles/phpmyadmin/tasks/archive_post.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
|
||||
- import_tasks: ../includes/webapps_compress_archive.yml
|
||||
vars:
|
||||
- root_dir: "{{ pma_root_dir }}"
|
||||
- version: "{{ pma_current_version }}"
|
||||
tags: pma
|
||||
|
8
roles/phpmyadmin/tasks/archive_pre.yml
Normal file
8
roles/phpmyadmin/tasks/archive_pre.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
|
||||
- import_tasks: ../includes/webapps_archive.yml
|
||||
vars:
|
||||
- root_dir: "{{ pma_root_dir }}"
|
||||
- version: "{{ pma_current_version }}"
|
||||
- db_name: "{{ pma_db_name }}"
|
||||
tags: pma
|
9
roles/phpmyadmin/tasks/cleanup.yml
Normal file
9
roles/phpmyadmin/tasks/cleanup.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
|
||||
- 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
|
||||
|
17
roles/phpmyadmin/tasks/conf.yml
Normal file
17
roles/phpmyadmin/tasks/conf.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
|
||||
- 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
|
||||
|
14
roles/phpmyadmin/tasks/directories.yml
Normal file
14
roles/phpmyadmin/tasks/directories.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
|
||||
- name: Create directory structure
|
||||
file: path={{ item.dir }} state=directory mode={{ item.mode | default(omit) }}
|
||||
loop:
|
||||
- dir: "{{ pma_root_dir }}"
|
||||
- dir: "{{ pma_root_dir }}/web"
|
||||
- dir: "{{ pma_root_dir }}/tmp"
|
||||
- dir: "{{ pma_root_dir }}/sessions"
|
||||
- dir: "{{ pma_root_dir }}/cache"
|
||||
- dir: "{{ pma_root_dir }}/meta"
|
||||
mode: 700
|
||||
- dir: "{{ pma_root_dir }}/data"
|
||||
tags: pma
|
37
roles/phpmyadmin/tasks/facts.yml
Normal file
37
roles/phpmyadmin/tasks/facts.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
|
||||
# Load distribution specific variables
|
||||
- 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
|
||||
|
||||
# Detect current version (if any) and set install_mode (to none, upgrade or install)
|
||||
- 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
|
||||
|
||||
# Generate a random key for cookie signing
|
||||
- block:
|
||||
- import_tasks: ../includes/get_rand_pass.yml
|
||||
vars:
|
||||
- pass_file: "{{ pma_root_dir }}/meta/key.txt"
|
||||
- set_fact: pma_key={{ rand_pass }}
|
||||
tags: pma
|
||||
|
||||
# Generate a DB password if not defined
|
||||
- when: pma_db_pass is not defined
|
||||
block:
|
||||
- import_tasks: ../includes/get_rand_pass.yml
|
||||
vars:
|
||||
- pass_file: "{{pma_root_dir }}/meta/ansible_dbpass"
|
||||
- set_fact: pma_db_pass={{ rand_pass }}
|
||||
tags: pma
|
54
roles/phpmyadmin/tasks/install.yml
Normal file
54
roles/phpmyadmin/tasks/install.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
|
||||
- name: Install dependencies
|
||||
yum: name={{ pma_packages }}
|
||||
tags: pma
|
||||
|
||||
- when: pma_install_mode != 'none'
|
||||
block:
|
||||
|
||||
- name: Download phpMyAdmin
|
||||
get_url:
|
||||
url: "{{ pma_archive_url }}"
|
||||
dest: "{{ pma_root_dir }}/tmp/"
|
||||
checksum: "sha256:{{ pma_archive_sha256 }}"
|
||||
|
||||
- name: Extract pma archive
|
||||
unarchive:
|
||||
src: "{{ pma_root_dir }}/tmp/phpMyAdmin-{{ pma_version }}-all-languages.zip"
|
||||
dest: "{{ pma_root_dir }}/tmp"
|
||||
remote_src: yes
|
||||
|
||||
- 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 }}"
|
||||
|
||||
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
|
||||
|
14
roles/phpmyadmin/tasks/main.yml
Normal file
14
roles/phpmyadmin/tasks/main.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
|
||||
- include: user.yml
|
||||
- include: directories.yml
|
||||
- include: facts.yml
|
||||
- include: archive_pre.yml
|
||||
when: pma_install_mode == 'upgrade'
|
||||
- include: install.yml
|
||||
- include: conf.yml
|
||||
- include: archive_post.yml
|
||||
when: pma_install_mode == 'upgrade'
|
||||
- include: cleanup.yml
|
||||
- include: write_version.yml
|
||||
|
8
roles/phpmyadmin/tasks/user.yml
Normal file
8
roles/phpmyadmin/tasks/user.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
|
||||
- import_tasks: ../includes/create_system_user.yml
|
||||
vars:
|
||||
- user: "{{ pma_php_user }}"
|
||||
- comment: "PHP FPM for pma {{ pma_id }}"
|
||||
tags: pma
|
||||
|
7
roles/phpmyadmin/tasks/write_version.yml
Normal file
7
roles/phpmyadmin/tasks/write_version.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- import_tasks: ../includes/webapps_post.yml
|
||||
vars:
|
||||
- root_dir: "{{ pma_root_dir }}"
|
||||
- version: "{{ pma_version }}"
|
||||
tags: pma
|
Reference in New Issue
Block a user