mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Merge branch 'master' into ansible
This commit is contained in:
commit
bc6ad9e6ba
14 changed files with 127 additions and 54 deletions
|
@ -1,2 +1,2 @@
|
|||
# Future overrides of /etc/ansible/ansible.cfg belong in this file.
|
||||
# Also used by iiab-admin-console
|
||||
# Also used by https://github.com/iiab/iiab-admin-console
|
|
@ -96,12 +96,12 @@ ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid}
|
|||
# system running ansible itself. This may include warnings about 3rd party packages or
|
||||
# other conditions that should be resolved if possible.
|
||||
# to disable these warnings, set the following value to False:
|
||||
system_warnings = True
|
||||
system_warnings = False
|
||||
|
||||
# by default (as of 1.4), Ansible may display deprecation warnings for language
|
||||
# features that should no longer be used and will be removed in future versions.
|
||||
# to disable these warnings, set the following value to False:
|
||||
deprecation_warnings = True
|
||||
deprecation_warnings = False
|
||||
|
||||
# set plugin path directories here, separate with colons
|
||||
action_plugins = /usr/share/ansible_plugins/action_plugins
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# This is a configuration file for IIAB
|
||||
# It can sourced in a shell script or read into an application
|
||||
# It can be sourced in a shell script or read into an application
|
||||
IIAB_BASE_PATH={{ iiab_base }}
|
||||
IIAB_DIR={{ iiab_dir }}
|
||||
IIAB_RELEASE={{ iiab_base_ver }}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
elgg_xx: elgg
|
||||
elgg_version: "2.3.5"
|
||||
elgg_version: "2.3.6"
|
||||
|
||||
# elgg_mysql_password: defined in default_vars
|
||||
elgg_url: /elgg
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
# Which kiwix-tools to download from http://download.iiab.io/packages/ (origin: http://download.kiwix.org/nightly/)
|
||||
kiwix_src_file_armhf: "kiwix-tools_armhf-2018-02-26.tar.gz"
|
||||
kiwix_src_file_linux64: "kiwix-tools_linux64-2018-02-26.tar.gz"
|
||||
kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" # Published Oct 2016 ("experimental")
|
||||
|
||||
kiwix_version_armhf: "kiwix-tools_armhf-0.4.0"
|
||||
kiwix_version_linux64: "kiwix-tools_linux64-0.4.0"
|
||||
kiwix_version_i686: "kiwix-0.10-linux-i686" # Published Oct 2016 ("experimental")
|
||||
# kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" # Published May 2014 ("use v0.9 to test legacy ZIM content")
|
||||
# KIWIX FOR i686 SHOULD BE REPLACED BEFORE FEB 2018: https://github.com/kiwix/kiwix-build/issues/94
|
||||
# KIWIX FOR i686 SHOULD BE REPLACED IN EARLY 2018: https://github.com/kiwix/kiwix-build/issues/94
|
||||
|
||||
kiwix_src_file_armhf: "{{ kiwix_version_armhf }}.tar.gz"
|
||||
kiwix_src_file_linux64: "{{ kiwix_version_linux64 }}.tar.gz"
|
||||
kiwix_src_file_i686: "{{ kiwix_version_i686 }}.tar.bz2"
|
||||
|
||||
kiwix_port: 3000
|
||||
# Expected to be used soon for Kiwix proxy:
|
||||
|
|
|
@ -60,26 +60,42 @@
|
|||
# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install
|
||||
# (We get a whole web server for i686 but only kiwix execs for linux64 & armhf)
|
||||
|
||||
- name: Unarchive Kiwix binaries to permanent location (NOT i686)
|
||||
unarchive:
|
||||
src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
||||
dest: "{{ kiwix_path }}/bin"
|
||||
owner: root
|
||||
group: root
|
||||
when: kiwix_src_bin_only and kiwix_force_install
|
||||
|
||||
- name: Unarchive kiwix*i686.tar.bz2 to /tmp (i686)
|
||||
- name: Unarchive kiwix-tools .tar.gz or .tar.bz2 to /tmp
|
||||
unarchive:
|
||||
src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
||||
dest: /tmp
|
||||
# dest: "{{ iiab_base }}"
|
||||
owner: root
|
||||
group: root
|
||||
when: not kiwix_src_bin_only and kiwix_force_install
|
||||
when: kiwix_force_install
|
||||
|
||||
- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (i686)
|
||||
shell: "mv /tmp/kiwix*i686/bin/* {{ kiwix_path }}/bin/"
|
||||
when: not kiwix_src_bin_only and kiwix_force_install
|
||||
- name: Move /tmp/{{ kiwix_src_dir }}/* to permanent location /opt/iiab/kiwix/bin (armhf & linux64)
|
||||
shell: "mv /tmp/{{ kiwix_src_dir }}/* {{ kiwix_path }}/bin/"
|
||||
when: kiwix_force_install and not kiwix_src_contains_bin
|
||||
|
||||
- name: Move /tmp/{{ kiwix_src_dir }}/bin/* to permanent location /opt/iiab/kiwix/bin (i686)
|
||||
shell: "mv /tmp/{{ kiwix_src_dir }}/bin/* {{ kiwix_path }}/bin/"
|
||||
when: kiwix_force_install and kiwix_src_contains_bin
|
||||
|
||||
#- name: Unarchive Kiwix binaries to permanent location (NOT i686)
|
||||
# unarchive:
|
||||
# src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
||||
# dest: "{{ kiwix_path }}/bin"
|
||||
# owner: root
|
||||
# group: root
|
||||
# when: kiwix_src_bin_only and kiwix_force_install
|
||||
|
||||
#- name: Unarchive kiwix*i686.tar.bz2 to /tmp (i686)
|
||||
# unarchive:
|
||||
# src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
|
||||
# dest: /tmp
|
||||
# # dest: "{{ iiab_base }}"
|
||||
# owner: root
|
||||
# group: root
|
||||
# when: not kiwix_src_bin_only and kiwix_force_install
|
||||
#
|
||||
#- name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (i686)
|
||||
# shell: "mv /tmp/kiwix*i686/bin/* {{ kiwix_path }}/bin/"
|
||||
# when: not kiwix_src_bin_only and kiwix_force_install
|
||||
|
||||
# 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU
|
||||
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_armhf }} (armv6l or armv71)"
|
||||
set_fact:
|
||||
kiwix_src_dir: "{{ kiwix_version_armhf }}"
|
||||
kiwix_src_file: "{{ kiwix_src_file_armhf }}"
|
||||
kiwix_src_bin_only: True
|
||||
kiwix_src_contains_bin: False
|
||||
when: ansible_machine == "armv7l" or ansible_machine == "armv6l"
|
||||
|
||||
- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_linux64 }} (x86_64)"
|
||||
set_fact:
|
||||
kiwix_src_dir: "{{ kiwix_version_linux64 }}"
|
||||
kiwix_src_file: "{{ kiwix_src_file_linux64 }}"
|
||||
kiwix_src_bin_only: True
|
||||
kiwix_src_contains_bin: False
|
||||
when: ansible_machine == "x86_64"
|
||||
|
||||
- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_i686 }} (i686)"
|
||||
set_fact:
|
||||
kiwix_src_dir: "{{ kiwix_version_i686 }}"
|
||||
kiwix_src_file: "{{ kiwix_src_file_i686 }}"
|
||||
kiwix_src_bin_only: False
|
||||
kiwix_src_contains_bin: True
|
||||
when: ansible_machine == "i686"
|
||||
# COMMENT OUT LINE ABOVE TO TEST i686 CODE PATH ON X86_64 (WORKS NOV 2017)
|
||||
|
||||
|
|
|
@ -16,6 +16,17 @@
|
|||
template:
|
||||
dest: /etc/NetworkManager/system-connections/
|
||||
src: network/bridge-br0
|
||||
mode: 0600
|
||||
|
||||
- name: Stop wpa_supplicant service
|
||||
service:
|
||||
name: wpa_supplicant
|
||||
state: stopped
|
||||
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
|
||||
|
||||
- name: Mask wpa_supplicant
|
||||
shell: systemctl mask wpa_supplicant
|
||||
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
|
||||
|
||||
- name: Reload systemd
|
||||
shell: systemctl daemon-reload
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[Unit]
|
||||
Description=DHCPv4 Server Daemon
|
||||
After=syslog.target network.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/sysconfig/dhcpd
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[Unit]
|
||||
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
|
||||
After=network.target
|
||||
After=rc-local.service
|
||||
|
||||
[Service]
|
||||
Type=idle
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[Unit]
|
||||
BindTo=%i.device
|
||||
After=%i.device
|
||||
After=rc-local.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
|
13
run-one-role.yml
Normal file
13
run-one-role.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- hosts: all
|
||||
become: yes
|
||||
|
||||
vars_files:
|
||||
- vars/default_vars.yml
|
||||
- vars/{{ ansible_local.local_facts.os_ver }}.yml
|
||||
- vars/local_vars.yml
|
||||
- /etc/iiab/config_vars.yml
|
||||
|
||||
roles:
|
||||
- { role: 0-init, tags: ['0-init'] }
|
||||
- { role: "{{ role_to_run }}", tags: ['run'] }
|
28
runrole
Executable file
28
runrole
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
INVENTORY="ansible_hosts"
|
||||
PLAYBOOK="run-one-role.yml"
|
||||
#PLAYBOOK="iiab-stages.yml"
|
||||
CWD=`pwd`
|
||||
|
||||
export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log"
|
||||
|
||||
if [ ! -f $PLAYBOOK ]; then
|
||||
echo "Exiting: IIAB Playbook not found."
|
||||
echo "Please run this in /opt/iiab/iiab (top level of the git repo)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Is the following stanza nec?
|
||||
if [ ! -f /etc/iiab/config_vars.yml ]; then
|
||||
mkdir -p /etc/iiab
|
||||
echo "{}" > /etc/iiab/config_vars.yml
|
||||
fi
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
echo " usage: ./runrole <name of role>"
|
||||
echo " Can only take a single value."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local -e "role_to_run=$1"
|
32
runtags
32
runtags
|
@ -1,19 +1,19 @@
|
|||
#!/bin/bash
|
||||
# running from a git repo
|
||||
PLAYBOOK="iiab.yml"
|
||||
|
||||
INVENTORY="ansible_hosts"
|
||||
PLAYBOOK="iiab.yml"
|
||||
#PLAYBOOK="iiab-stages.yml"
|
||||
CWD=`pwd`
|
||||
|
||||
export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log"
|
||||
|
||||
if [ ! -f $PLAYBOOK ]
|
||||
then
|
||||
echo "IIAB Playbook not found."
|
||||
echo "Please run this command from the top level of the git repo."
|
||||
echo "Exiting."
|
||||
exit
|
||||
if [ ! -f $PLAYBOOK ]; then
|
||||
echo "Exiting: IIAB Playbook not found."
|
||||
echo "Please run this in /opt/iiab/iiab (top level of the git repo)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Is the following stanza nec?
|
||||
if [ ! -f /etc/iiab/config_vars.yml ]; then
|
||||
mkdir -p /etc/iiab
|
||||
echo "{}" > /etc/iiab/config_vars.yml
|
||||
|
@ -21,31 +21,27 @@ fi
|
|||
|
||||
tags=$(echo $1 | tr "," "\n")
|
||||
|
||||
if [ "$tags" == "" ]
|
||||
then
|
||||
if [ "$tags" == "" ]; then
|
||||
echo " usage: ./runtags <tagname>"
|
||||
echo " usage: ./runtags <tagname1>,<tagname2>,<tagname3>"
|
||||
echo " Can take a single value or a comma-separated list (no spaces within the list!)"
|
||||
echo " Now retrieving a list of possible Ansible playbook and tagname values..."
|
||||
ansible-playbook -i ansible_hosts iiab.yml --connection=local --list-tag
|
||||
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local --list-tags
|
||||
exit 0
|
||||
fi
|
||||
|
||||
found="N"
|
||||
|
||||
for tag in $tags
|
||||
do
|
||||
if [ "$tag" == "0-init" ]
|
||||
then
|
||||
for tag in $tags; do
|
||||
if [ "$tag" == "0-init" ]; then
|
||||
found="Y"
|
||||
fi
|
||||
done
|
||||
|
||||
taglist=$1
|
||||
|
||||
if [ "$found" == "N" ]
|
||||
then
|
||||
if [ "$found" == "N" ]; then
|
||||
taglist="0-init,"$taglist
|
||||
fi
|
||||
|
||||
ansible-playbook -i ansible_hosts iiab.yml --connection=local --tags="""$taglist"""
|
||||
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local --tags=$taglist
|
||||
|
|
Loading…
Reference in a new issue