1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00

Merge branch 'master' into sugarizer

This commit is contained in:
A Holt 2017-11-19 23:02:58 -05:00 committed by GitHub
commit 10d13601d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 179 additions and 89 deletions

View file

@ -1,6 +1,6 @@
# use these as a tag a release at a point in time
iiab_base_ver: 6.4
gui_version: 2
iiab_revision: 0
# These entries should never be changed in this file.
# These are defaults for boolean routines,

View file

@ -1,35 +1,39 @@
# workaround for fact that auto create does not work on ini_file
- name: Create iiab config file
file: dest='{{ iiab_config_file }}'
state=touch
file:
dest: '{{ iiab_config_file }}'
state: touch
- name: Add location section to config file
ini_file: dest='{{ iiab_config_file }}'
section=location
option='{{ item.option }}'
value='{{ item.value }}'
ini_file:
dest: '{{ iiab_config_file }}'
section: location
option: '{{ item.option }}'
value: '{{ item.value }}'
with_items:
- option: 'iiab_base'
value: '{{ iiab_base }}'
- option: 'iiab_dir'
value: '{{ iiab_dir }}'
- name: Add version section
ini_file: dest='{{ iiab_config_file }}'
section=version
option='{{ item.option }}'
value='{{ item.value }}'
- name: add version section
ini_file:
dest: '{{ iiab_config_file }}'
section: version
option: '{{ item.option }}'
value: '{{ item.value }}'
with_items:
- option: 'distribution'
value: '{{ ansible_distribution }}'
- option: 'arch'
value: '{{ ansible_architecture }}'
- option: 'iiab_base_ver'
value: '{{ iiab_base_ver }}'
- option: 'iiab_branch'
value: '{{ ansible_local["local_facts"]["iiab_branch"] }}'
value: '{{ ansible_local.local_facts.iiab_branch }}'
- option: 'iiab_commit'
value: '{{ ansible_local["local_facts"]["iiab_commit"] }}'
value: '{{ ansible_local.local_facts.iiab_commit }}'
- option: 'install_date'
value: '{{ ansible_date_time["iso8601"] }}'
value: '{{ ansible_date_time.iso8601 }}'
- option: 'install_xo'
value: '{{ xo_model }}'

View file

@ -20,13 +20,12 @@
- name: Re-read local_facts.facts from /etc/ansible/facts.d
setup: filter=ansible_local
# set top level variables from local facts for convenience
- set_fact:
- name: Set top level variables from local facts for convenience
set_fact:
xo_model: '{{ ansible_local.local_facts.xo_model }}'
phplib_dir: '{{ ansible_local.local_facts.phplib_dir }}'
iiab_stage: '{{ ansible_local.local_facts.stage }}'
# Networking uses a different file for the rpi
- name: Discover if this is running Raspbian -- if so assume it is a RPi
set_fact:
rpi_model: "rpi"
@ -164,6 +163,10 @@
with_items:
- option: 'iiab_stage'
value: '{{ iiab_stage }}'
- option: 'iiab_base_ver'
value: '{{ iiab_base_ver }}'
- option: 'iiab_revision'
value: '{{ iiab_revision }}'
- option: 'runtime_php'
value: '{{ phplib_dir }}'
- option: 'runtime_branch'

View file

@ -2,6 +2,8 @@
# It can sourced in a shell script or read into an application
IIAB_BASE_PATH={{ iiab_base }}
IIAB_DIR={{ iiab_dir }}
IIAB_RELEASE={{ iiab_base_ver }}
IIAB_REVISION={{ iiab_revision }}
OS={{ ansible_local.local_facts.os }}
OS_VER={{ ansible_local.local_facts.os_ver }}
WWWROOT={{ doc_root }}

View file

@ -62,10 +62,5 @@
mode={{ item.mode }}
with_items:
- { src: 'kalite-serve.service.j2', dest: '/etc/systemd/system/kalite-serve.service', mode: '0644'}
- { src: 'kalite.sh.j2', dest: '/etc/profile.d/kalite.sh', mode: '0644'}
- { src: 'kalite.sh.j2', dest: '/usr/bin/kalite', mode: '0755'}
- { src: 'kalite.conf', dest: '/etc/{{ apache_config_dir }}', mode: '0644'}
- name: Create symlink to kalite bin file in path
file: path=/usr/bin/kalite
src={{ kalite_venv }}/bin/kalite
state=link

View file

@ -1,2 +1,4 @@
#!/bin/bash
KALITE_HOME={{ kalite_root }}
export KALITE_HOME
{{ kalite_venv }}/bin/kalite $@

View file

@ -60,10 +60,10 @@
with_items: "{{ files_to_delete.files }}"
- name: add mongodb to service list
ini_file: dest='{{ service_filelist }}'
ini_file: dest="{{ service_filelist }}"
section=mongodb
option='{{ item.option }}'
value='"{{ item.value }}"'
option="{{ item.option }}"
value="{{ item.value }}"
with_items:
- option: name
value: MongoDB

View file

@ -81,11 +81,10 @@
ap_device: "eth0"
when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5"
# takes adapter name
- name: Blacklisted WiFi adapter
- name: Exclude reserved WiFi adapter if defined - takes adapter name
set_fact:
ap_device: "{{ blacklist_wifi }}"
when: blacklist_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
ap_device: "{{ reserved_wifi }}"
when: reserved_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
- name: Count LAN ifaces
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e {{ device_gw }} -e {{ ap_device }} | wc -l

View file

@ -1,3 +1,4 @@
phpmyadmin_install: 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,45 +1,81 @@
- name: Get the phpMyAdmin software
get_url: url="{{ iiab_download_url }}/{{ phpMyAdmin }}" dest="{{ downloads_dir }}/phpMyAdmin.zip"
when: internet_available
- name: Download the phpMyAdmin software
get_url:
url: "{{ iiab_download_url }}/{{ phpmyadmin_name_zip }}"
dest: "{{ downloads_dir }}"
#register: phpmyadmin_dl_output
when: internet_available
- name: Copy it to permanent location /opt
unarchive: src={{ downloads_dir }}/phpMyAdmin.zip dest=/opt/
- name: Check if /opt/iiab/downloads/{{ phpmyadmin_name_zip }} exists
stat:
path: "{{ downloads_dir }}/{{ phpmyadmin_name_zip }}"
register: phpmyadmin_dl
- name: Create a symbolic link to the folder of the current version phpMyAdmin
file: path=/opt/phpmyadmin src=phpMyAdmin-4.7.5-all-languages state=link
- 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: Copy the phpMyAdmin config file into place
template: src=config.inc.php dest=/opt/phpmyadmin/config.inc.php
- name: Unzip to permanent location /opt/{{ phpmyadmin_name }}
unarchive:
src: "{{ downloads_dir }}/{{ phpmyadmin_name_zip }}"
dest: /opt
owner: "{{ apache_user }}"
- name: Change the owner of the PHP tree to Apache
shell: "chown -R {{ apache_user }} /opt/phpmyadmin"
- name: Create symbolic link /opt/phpmyadmin to phpMyAdmin folder above
file:
src: "{{ phpmyadmin_name }}"
dest: /opt/phpmyadmin
owner: "{{ apache_user }}"
state: link
- name: Put the alias into Apache config when enabled
template: src=phpmyadmin.j2 dest=/etc/{{ apache_config_dir }}/phpmyadmin.conf
when: phpmyadmin_enabled
- name: Copy phpMyAdmin's config file into place
template:
src: config.inc.php
dest: /opt/phpmyadmin/config.inc.php
owner: "{{ apache_user }}"
- name: Enable phpMyAdmin
file: path=/etc/apache2/sites-enabled/phpmyadmin.conf
src=/etc/apache2/sites-available/phpmyadmin.conf
state=link
when: phpmyadmin_enabled and is_debuntu
# Above 3 stanzas set link/tree/contents ownership to {{ apache_user }}:root
# OOPS: CHOWN BELOW CHANGED LINK ALONE (TREE/CONTENTS REMAINED root:root)
- 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
# - 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: Add phpmyadmin to service list
ini_file: dest='{{ service_filelist }}'
section=phpmyadmin
option='{{ item.option }}'
value='"{{ item.value }}"'
with_items:
- option: name
value: phpMyAdmin
- option: description
value: '"phpMyAdmin is an interface with a MySQL database written in PHP, and available to administer the database engine locally or across the network."'
- option: path
value: /opt/phpmyadmin
- option: enabled
value: "{{ phpmyadmin_enabled }}"
- 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
dest: /etc/apache2/sites-enabled/phpmyadmin.conf
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
- name: Add phpmyadmin to service list
ini_file:
dest: "{{ service_filelist }}"
section: phpmyadmin
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- option: name
value: phpMyAdmin
- option: description
value: '"phpMyAdmin is an interface with a MySQL database written in PHP, and available to administer the database engine locally or across the network."'
- option: path
value: /opt/phpmyadmin
- option: enabled
value: "{{ phpmyadmin_enabled }}"

View file

@ -1,11 +1,18 @@
wordpress_download_base_url: https://wordpress.org
wordpress_src: latest.tar.gz
wp_db_name: iiab_wp
wp_db_user: iiab_wp
wp_db_user_password: changeme
wordpress_install: True
wordpress_enabled: True
wp_install_path: /library
wp_abs_path: /library/wordpress
wp_install_path: "{{ content_base }}"
#wp_install_path: /library
wp_abs_path: "{{ wp_install_path }}/wordpress"
#wp_abs_path: /library/wordpress
wp_url: /wordpress
wp_full_url: "http://{{ iiab_hostname }}{{ wp_url }}"

View file

@ -1,25 +1,64 @@
- name: Get the WordPress software
get_url: url="{{ wordpress_download_base_url }}/{{ wordpress_src }}" dest={{ downloads_dir }}/
# IF YOU NEED TO REINSTALL FROM /opt/iiab/downloads/wordpress.tar.gz
# TO /library/wordpress DURING YOUR NEXT RUN OF "./runtags wordpress" OR
# "./iiab-install" THEN YOU FIRST NEED TO:
#
# - "mv /library/wordpress /library/wordpress.old" (MUST)
# - back up then drop the database (RECOMMENDED)
#
# REASON: "keep_newer: yes" below tries to preserves WordPress's self-upgrades
# & security enhancements within /library/wordpress, that can occur without
# warning when WordPress is online, since WordPress ~4.8 especially.
#
# Such "emergency" reinstalls from /opt/iiab/downloads/wordpress.tar.gz to
# /library/wordpress should also work offline.
- name: Download the latest WordPress software
get_url:
url: "{{ wordpress_download_base_url }}/{{ wordpress_src }}"
dest: "{{ downloads_dir }}"
# force: yes
# backup: yes
register: wp_download_output
when: internet_available
- name: Copy it to permanent location /library
unarchive: src={{ wp_download_output.dest }} dest=/library
when: internet_available
- name: Create link /opt/iiab/downloads/wordpress.tar.gz pointing to {{ wp_download_output.dest }}
file:
src: "{{ wp_download_output.dest }}"
dest: "{{ downloads_dir }}/wordpress.tar.gz"
state: link
when: wp_download_output.dest is defined
- name: Rename /library/wordpress* to /library/wordpress
shell: if [ ! -d {{ wp_abs_path }} ]; then mv {{ wp_abs_path }}* {{ wp_abs_path }}; fi
- name: Check if /opt/iiab/downloads/wordpress.tar.gz link exists
stat:
path: "{{ downloads_dir }}/wordpress.tar.gz"
register: wp_link
# First pass at permissions and ownership
- name: Make Apache owner and group
file: path={{ wp_abs_path }}
recurse=yes
owner=root
group={{ apache_user }}
mode=0664
state=directory
- name: FAIL (force Ansible to exit) IF /opt/iiab/downloads/wordpress.tar.gz doesn't exist
fail:
msg: "{{ downloads_dir }}/wordpress.tar.gz is REQUIRED in order to install WordPress."
when: not wp_link.stat.exists
- name: Make directories 775 so Apache can traverse and write
- name: "Unpack /opt/iiab/downloads/wordpress.tar.gz to permanent location /library/wordpress - owner: root, group: {{ apache_user }}, mode: 0664, keep_newer: yes"
unarchive:
src: "{{ downloads_dir }}/wordpress.tar.gz"
dest: "{{ wp_install_path }}"
owner: root
group: "{{ apache_user }}"
mode: 0664
keep_newer: yes
# - name: Rename /library/wordpress* to /library/wordpress
# shell: if [ ! -d {{ wp_abs_path }} ]; then mv {{ wp_abs_path }}* {{ wp_abs_path }}; fi
#- name: Make Apache owner and group, 1st pass permissions set to 0664
# file: path={{ wp_abs_path }}
# recurse=yes
# owner=root
# group={{ apache_user }}
# mode=0664
# state=directory
- name: Make /library/wordpress directories 775 so Apache can traverse and write (most files remain 0664)
command: "/usr/bin/find {{ wp_abs_path }} -type d -exec chmod 775 {} +"
- name: Copy wp salt values

View file

@ -1,3 +1,5 @@
# SEE "emergency" REINSTALL INSTRUCTIONS IN roles/wordpress/tasks/install.yml
- name: Include the install playbook
include_tasks: install.yml
when: wordpress_install
when: wordpress_install