1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #31 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2017-11-17 22:15:12 -05:00 committed by GitHub
commit 1018aa6d5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 75 additions and 38 deletions

View file

@ -1,3 +1,4 @@
phpmyadmin_install: False phpmyadmin_install: False
phpmyadmin_enabled: False phpmyadmin_enabled: False
phpMyAdmin: "phpMyAdmin-4.7.5-all-languages.zip" phpmyadmin_name: "phpMyAdmin-4.7.5-all-languages"
phpmyadmin_name_zip: "{{ phpmyadmin_name }}.zip"

View file

@ -1,39 +1,75 @@
- name: Get the phpMyAdmin software - name: Download the phpMyAdmin software
get_url: url="{{ iiab_download_url }}/{{ phpMyAdmin }}" dest="{{ downloads_dir }}/phpMyAdmin.zip" get_url:
url: "{{ iiab_download_url }}/{{ phpmyadmin_name_zip }}"
dest: "{{ downloads_dir }}"
#register: phpmyadmin_dl_output
when: internet_available when: internet_available
- name: Copy it to permanent location /opt - name: Check if /opt/iiab/downloads/{{ phpmyadmin_name_zip }} exists
unarchive: src={{ downloads_dir }}/phpMyAdmin.zip dest=/opt/ stat:
path: "{{ downloads_dir }}/{{ phpmyadmin_name_zip }}"
register: phpmyadmin_dl
- name: Create a symbolic link to the folder of the current version phpMyAdmin - name: FAIL (force Ansible to exit) IF /opt/iiab/downloads/{{ phpmyadmin_name_zip }} doesn't exist
file: path=/opt/phpmyadmin src=phpMyAdmin-4.7.5-all-languages state=link fail:
msg: "{{ downloads_dir }}/{{ phpmyadmin_name_zip }} is REQUIRED in order to install phpMyAdmin."
when: not phpmyadmin_dl.stat.exists
- name: Copy the phpMyAdmin config file into place - name: Unzip to permanent location /opt/{{ phpmyadmin_name }}
template: src=config.inc.php dest=/opt/phpmyadmin/config.inc.php unarchive:
src: "{{ downloads_dir }}/{{ phpmyadmin_name_zip }}"
dest: /opt
owner: "{{ apache_user }}"
- name: Change the owner of the PHP tree to Apache - name: Create symbolic link /opt/phpmyadmin to phpMyAdmin folder above
shell: "chown -R {{ apache_user }} /opt/phpmyadmin" file:
src: "{{ phpmyadmin_name }}"
dest: /opt/phpmyadmin
owner: "{{ apache_user }}"
state: link
- name: Put the alias into Apache config when enabled - name: Copy phpMyAdmin's config file into place
template: src=phpmyadmin.j2 dest=/etc/{{ apache_config_dir }}/phpmyadmin.conf 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 when: phpmyadmin_enabled
- name: Enable phpMyAdmin - name: Enable phpMyAdmin
file: path=/etc/apache2/sites-enabled/phpmyadmin.conf file:
src=/etc/apache2/sites-available/phpmyadmin.conf src: /etc/apache2/sites-available/phpmyadmin.conf
state=link dest: /etc/apache2/sites-enabled/phpmyadmin.conf
state: link
when: phpmyadmin_enabled and is_debuntu when: phpmyadmin_enabled and is_debuntu
- name: Remove the alias into Apache config when not enabled - name: Remove the alias into Apache config when not enabled
file: path=/etc/apache2/sites-enabled/phpmyadmin.conf file:
state=absent path: /etc/apache2/sites-enabled/phpmyadmin.conf
state: absent
when: not phpmyadmin_enabled and is_debuntu when: not phpmyadmin_enabled and is_debuntu
- name: Add phpmyadmin to service list - name: Add phpmyadmin to service list
ini_file: dest='{{ service_filelist }}' ini_file:
section=phpmyadmin dest: "{{ service_filelist }}"
option='{{ item.option }}' section: phpmyadmin
value='"{{ item.value }}"' option: "{{ item.option }}"
value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: phpMyAdmin value: phpMyAdmin