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 # use these as a tag a release at a point in time
iiab_base_ver: 6.4 iiab_base_ver: 6.4
gui_version: 2 iiab_revision: 0
# These entries should never be changed in this file. # These entries should never be changed in this file.
# These are defaults for boolean routines, # These are defaults for boolean routines,

View file

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

View file

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

View file

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

View file

@ -62,10 +62,5 @@
mode={{ item.mode }} mode={{ item.mode }}
with_items: with_items:
- { src: 'kalite-serve.service.j2', dest: '/etc/systemd/system/kalite-serve.service', mode: '0644'} - { 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'} - { 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 }} KALITE_HOME={{ kalite_root }}
export KALITE_HOME export KALITE_HOME
{{ kalite_venv }}/bin/kalite $@

View file

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

View file

@ -81,11 +81,10 @@
ap_device: "eth0" ap_device: "eth0"
when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5" when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5"
# takes adapter name - name: Exclude reserved WiFi adapter if defined - takes adapter name
- name: Blacklisted WiFi adapter
set_fact: set_fact:
ap_device: "{{ blacklist_wifi }}" ap_device: "{{ reserved_wifi }}"
when: blacklist_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2" when: reserved_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
- name: Count LAN ifaces - 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 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_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,45 +1,81 @@
- name: Get the phpMyAdmin software - name: Download the phpMyAdmin software
get_url: url="{{ iiab_download_url }}/{{ phpMyAdmin }}" dest="{{ downloads_dir }}/phpMyAdmin.zip" get_url:
when: internet_available url: "{{ iiab_download_url }}/{{ phpmyadmin_name_zip }}"
dest: "{{ downloads_dir }}"
#register: phpmyadmin_dl_output
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:
when: phpmyadmin_enabled src: config.inc.php
dest: /opt/phpmyadmin/config.inc.php
owner: "{{ apache_user }}"
- name: Enable phpMyAdmin # Above 3 stanzas set link/tree/contents ownership to {{ apache_user }}:root
file: path=/etc/apache2/sites-enabled/phpmyadmin.conf # OOPS: CHOWN BELOW CHANGED LINK ALONE (TREE/CONTENTS REMAINED root:root)
src=/etc/apache2/sites-available/phpmyadmin.conf
state=link
when: phpmyadmin_enabled and is_debuntu
- name: Remove the alias into Apache config when not enabled # - name: Change the owner of the PHP tree to Apache
file: path=/etc/apache2/sites-enabled/phpmyadmin.conf # shell: "chown -R {{ apache_user }} /opt/phpmyadmin"
state=absent # #file:
when: not phpmyadmin_enabled and is_debuntu # # path: "/opt/{{ phpmyadmin_name_zip }}"
# # owner: "{{ apache_user }}"
# # recurse: yes
# # state: directory
- name: Add phpmyadmin to service list - name: Put the alias into Apache config when enabled
ini_file: dest='{{ service_filelist }}' template:
section=phpmyadmin src: phpmyadmin.j2
option='{{ item.option }}' dest: "/etc/{{ apache_config_dir }}/phpmyadmin.conf"
value='"{{ item.value }}"' when: phpmyadmin_enabled
with_items:
- option: name - name: Enable phpMyAdmin
value: phpMyAdmin file:
- option: description src: /etc/apache2/sites-available/phpmyadmin.conf
value: '"phpMyAdmin is an interface with a MySQL database written in PHP, and available to administer the database engine locally or across the network."' dest: /etc/apache2/sites-enabled/phpmyadmin.conf
- option: path state: link
value: /opt/phpmyadmin when: phpmyadmin_enabled and is_debuntu
- option: enabled
value: "{{ phpmyadmin_enabled }}" - 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_download_base_url: https://wordpress.org
wordpress_src: latest.tar.gz wordpress_src: latest.tar.gz
wp_db_name: iiab_wp wp_db_name: iiab_wp
wp_db_user: iiab_wp wp_db_user: iiab_wp
wp_db_user_password: changeme wp_db_user_password: changeme
wordpress_install: True wordpress_install: True
wordpress_enabled: 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_url: /wordpress
wp_full_url: "http://{{ iiab_hostname }}{{ wp_url }}" wp_full_url: "http://{{ iiab_hostname }}{{ wp_url }}"

View file

@ -1,25 +1,64 @@
- name: Get the WordPress software # IF YOU NEED TO REINSTALL FROM /opt/iiab/downloads/wordpress.tar.gz
get_url: url="{{ wordpress_download_base_url }}/{{ wordpress_src }}" dest={{ downloads_dir }}/ # 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 register: wp_download_output
when: internet_available when: internet_available
- name: Copy it to permanent location /library - name: Create link /opt/iiab/downloads/wordpress.tar.gz pointing to {{ wp_download_output.dest }}
unarchive: src={{ wp_download_output.dest }} dest=/library file:
when: internet_available 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 - name: Check if /opt/iiab/downloads/wordpress.tar.gz link exists
shell: if [ ! -d {{ wp_abs_path }} ]; then mv {{ wp_abs_path }}* {{ wp_abs_path }}; fi stat:
path: "{{ downloads_dir }}/wordpress.tar.gz"
register: wp_link
# First pass at permissions and ownership - name: FAIL (force Ansible to exit) IF /opt/iiab/downloads/wordpress.tar.gz doesn't exist
- name: Make Apache owner and group fail:
file: path={{ wp_abs_path }} msg: "{{ downloads_dir }}/wordpress.tar.gz is REQUIRED in order to install WordPress."
recurse=yes when: not wp_link.stat.exists
owner=root
group={{ apache_user }}
mode=0664
state=directory
- 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 {} +" command: "/usr/bin/find {{ wp_abs_path }} -type d -exec chmod 775 {} +"
- name: Copy wp salt values - 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 - name: Include the install playbook
include_tasks: install.yml include_tasks: install.yml
when: wordpress_install when: wordpress_install