2017-11-17 03:42:30 +00:00
- name : Download the phpMyAdmin software
2017-11-17 03:22:24 +00:00
get_url :
url : "{{ iiab_download_url }}/{{ phpmyadmin_name_zip }}"
dest : "{{ downloads_dir }}"
2017-11-17 03:56:34 +00:00
#register: phpmyadmin_dl_output
2017-11-17 03:22:24 +00:00
when : internet_available
- name : Check if /opt/iiab/downloads/{{ phpmyadmin_name_zip }} exists
stat :
path : "{{ downloads_dir }}/{{ phpmyadmin_name_zip }}"
register : phpmyadmin_dl
- name : FAIL (force Ansible to exit) IF /opt/iiab/downloads/{{ phpmyadmin_name_zip }} doesn't exist
fail :
msg : "{{ downloads_dir }}/{{ phpmyadmin_name_zip }} is REQUIRED in order to install phpMyAdmin."
when : not phpmyadmin_dl.stat.exists
- name : Unzip to permanent location /opt/{{ phpmyadmin_name }}
unarchive :
src : "{{ downloads_dir }}/{{ phpmyadmin_name_zip }}"
dest : /opt
owner : "{{ apache_user }}"
- name : Create symbolic link /opt/phpmyadmin to phpMyAdmin folder above
file :
src : "{{ phpmyadmin_name }}"
2017-11-17 03:47:39 +00:00
dest : /opt/phpmyadmin
2017-11-17 03:22:24 +00:00
owner : "{{ apache_user }}"
state : link
- name : Copy phpMyAdmin's config file into place
template :
src : config.inc.php
dest : /opt/phpmyadmin/config.inc.php
owner : "{{ apache_user }}"
# Above 3 stanzas set link/tree/contents ownership to {{ apache_user }}:root
# OOPS: CHOWN BELOW CHANGED LINK ALONE (TREE/CONTENTS REMAINED root:root)
# - name: Change the owner of the PHP tree to Apache
# shell: "chown -R {{ apache_user }} /opt/phpmyadmin"
# #file:
# # path: "/opt/{{ phpmyadmin_name_zip }}"
# # owner: "{{ apache_user }}"
# # recurse: yes
# # state: directory
- name : Put the alias into Apache config when enabled
template :
src : phpmyadmin.j2
dest : "/etc/{{ apache_config_dir }}/phpmyadmin.conf"
when : phpmyadmin_enabled
- name : Enable phpMyAdmin
file :
src : /etc/apache2/sites-available/phpmyadmin.conf
2017-11-17 03:47:39 +00:00
dest : /etc/apache2/sites-enabled/phpmyadmin.conf
2017-11-17 03:22:24 +00:00
state : link
when : phpmyadmin_enabled and is_debuntu
- name : Remove the alias into Apache config when not enabled
file :
path : /etc/apache2/sites-enabled/phpmyadmin.conf
state : absent
when : not phpmyadmin_enabled and is_debuntu
2017-11-27 01:05:53 +00:00
- name : Add phpmyadmin to list of services at /etc/iiab/iiab.ini
2017-11-17 03:22:24 +00:00
ini_file :
dest : "{{ service_filelist }}"
section : phpmyadmin
option : "{{ item.option }}"
value : "{{ item.value }}"
with_items :
- option : name
value : phpMyAdmin
- option : description
2017-11-17 04:05:52 +00:00
value : '"phpMyAdmin is an interface with a MySQL database written in PHP, and available to administer the database engine locally or across the network."'
2017-11-17 03:22:24 +00:00
- option : path
value : /opt/phpmyadmin
- option : enabled
value : "{{ phpmyadmin_enabled }}"