1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Merge pull request #497 from holta/master

Ansible output and code more readable
This commit is contained in:
A Holt 2017-11-08 02:17:38 -05:00 committed by GitHub
commit e77c2078c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 35 additions and 36 deletions

View file

@ -19,7 +19,7 @@ if [ ! -f $PLAYBOOK ]; then
exit 1 exit 1
fi fi
if [ $OS = "raspbian" ]; then if [ $OS == "raspbian" ]; then
echo "Found Raspbian" echo "Found Raspbian"
ABORT=`uname -a | grep $OLD_RPI_KERN | wc -l` ABORT=`uname -a | grep $OLD_RPI_KERN | wc -l`
if [ "$ABORT" == 1 ]; then if [ "$ABORT" == 1 ]; then
@ -41,16 +41,16 @@ STAGE=""
if [ ! -f /etc/iiab/iiab.env ]; then if [ ! -f /etc/iiab/iiab.env ]; then
mkdir -p /etc/iiab mkdir -p /etc/iiab
./scripts/ansible # ./scripts/ansible # needs discussion
else else
OLD=`grep XSCE /etc/iiab/iiab.env | wc -l` OLD=`grep XSCE /etc/iiab/iiab.env | wc -l`
if [ "$OLD" != 0 ] || [ "$1" = "--reinstall" ]; then if [ "$OLD" != 0 ] || [ "$1" == "--reinstall" ]; then
echo "Found old XSCE install - re-installing from scratch" echo "Found old XSCE install - re-installing from scratch"
rm /etc/iiab/iiab.env rm /etc/iiab/iiab.env
# check ansible version here and force ansible upgrade if needed # check ansible version here and force ansible upgrade if needed
else else
source /etc/iiab/iiab.env source /etc/iiab/iiab.env
if [ "$1" = "--debug" ]; then if [ "$1" == "--debug" ]; then
echo "Entering debug mode" echo "Entering debug mode"
sed -i -e 's/^STAGE=.*/STAGE=2/' /etc/iiab/iiab.env sed -i -e 's/^STAGE=.*/STAGE=2/' /etc/iiab/iiab.env
elif [ ! $STAGE == 9 ]; then elif [ ! $STAGE == 9 ]; then

View file

@ -1,8 +1,8 @@
- name: Creat filesytem layout - name: Create filesytem layout
include_tasks: roles/2-common/tasks/fl.yml include_tasks: roles/2-common/tasks/fl.yml
when: first_run when: first_run
- name: turn the crank for systemd - name: Turn the crank for systemd
shell: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}" shell: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}"
when: is_debuntu when: is_debuntu
@ -36,7 +36,7 @@
- network - network
- domain - domain
- name: Configuring squid - name: Configuring Squid
include_tasks: roles/network/tasks/squid.yml include_tasks: roles/network/tasks/squid.yml
when: squid_install when: squid_install
tags: tags:

View file

@ -56,7 +56,7 @@
when: usb_lib_install when: usb_lib_install
tags: usb-lib tags: usb-lib
- name: Put a Python interface to iiab.env - name: Create a Python interface to iiab.env
template: src=roles/1-prep/templates/iiab_env.py.j2 template: src=roles/1-prep/templates/iiab_env.py.j2
dest=/etc/iiab/iiab_env.py dest=/etc/iiab/iiab_env.py

View file

@ -19,7 +19,7 @@
# extra_args="--disable-pip-version-check" # extra_args="--disable-pip-version-check"
when: internet_available and is_debuntu when: internet_available and is_debuntu
- name: Install KA Lite with pip (OS's other than debuntu) - name: Install KA Lite with pip (debuntu)
pip: name=ka-lite-static pip: name=ka-lite-static
version={{ kalite_version }} version={{ kalite_version }}
virtualenv={{ kalite_venv }} virtualenv={{ kalite_venv }}

View file

@ -1,4 +1,4 @@
- name: Install MySQL for Debian/Debuntu - name: Install MySQL (debuntu)
package: name={{ item }} package: name={{ item }}
state=present state=present
with_items: with_items:
@ -26,7 +26,7 @@
package: name=php-xml-parser state=present package: name=php-xml-parser state=present
when: is_debian_8 when: is_debian_8
- name: Install MySQL for non-Debian/Debuntu - name: Install MySQL (OS's other than debuntu)
package: name={{ item }} package: name={{ item }}
state=present state=present
with_items: with_items:

View file

@ -60,7 +60,7 @@
enabled=yes enabled=yes
when: dnsmasq_enabled and dnsmasq_install when: dnsmasq_enabled and dnsmasq_install
- name: Enable dansguardian - name: Enable DansGuardian
service: name=dansguardian service: name=dansguardian
enabled=yes enabled=yes
when: dansguardian_enabled and dansguardian_install when: dansguardian_enabled and dansguardian_install

View file

@ -6,19 +6,19 @@
mode=0644 mode=0644
when: discovered_wireless_iface is defined when: discovered_wireless_iface is defined
- name: Disable the Access Point Hostapd program - name: Disable the Access Point 'hostapd' service
service: enabled=no service: enabled=no
name=hostapd.service name=hostapd.service
when: not iiab_wireless_lan_iface is defined or iiab_network_mode == "Appliance" or not hostapd_enabled when: not iiab_wireless_lan_iface is defined or iiab_network_mode == "Appliance" or not hostapd_enabled
- name: Use custom systemd unit file to start hostapd - name: Use custom systemd unit file to start 'hostapd' service
template: src=hostapd/hostapd.service.j2 template: src=hostapd/hostapd.service.j2
dest=/etc/systemd/system/hostapd.service dest=/etc/systemd/system/hostapd.service
owner=root owner=root
group=root group=root
mode=0644 mode=0644
- name: Enable the Access Point Hostapd program - name: Enable the Access Point 'hostapd' service
service: enabled=yes service: enabled=yes
name=hostapd.service name=hostapd.service
when: iiab_wireless_lan_iface is defined and iiab_network_mode != "Appliance" and hostapd_enabled when: iiab_wireless_lan_iface is defined and iiab_network_mode != "Appliance" and hostapd_enabled

View file

@ -17,7 +17,7 @@
state=stopped state=stopped
when: dansguardian_install when: dansguardian_install
- name: Restart DansGuardian - execpt Ubuntu which needs reboot to activate - name: Restart DansGuardian - except Ubuntu which needs reboot to activate
service: name=dansguardian service: name=dansguardian
state=restarted state=restarted
when: dansguardian_enabled and dansguardian_install and ( not is_ubuntu and iiab_stage|int < 4 ) when: dansguardian_enabled and dansguardian_install and ( not is_ubuntu and iiab_stage|int < 4 )
@ -42,18 +42,18 @@
creates=/etc/sysconfig/olpc-scripts/setup.d/installed/gateway creates=/etc/sysconfig/olpc-scripts/setup.d/installed/gateway
when: iiab_network_mode == "Gateway" when: iiab_network_mode == "Gateway"
- name: Waiting {{ hostapd_wait }} seconds for network to stablize - name: Waiting {{ hostapd_wait }} seconds for network to stabilize
shell: sleep {{ hostapd_wait }} shell: sleep {{ hostapd_wait }}
- name: Run iptables - name: Run iptables
command: /usr/bin/iiab-gen-iptables command: /usr/bin/iiab-gen-iptables
- name: Checking if wifi slave is active - name: Checking if WiFi slave is active
shell: brctl show br0 | grep {{ iiab_wireless_lan_iface }} | wc -l shell: brctl show br0 | grep {{ iiab_wireless_lan_iface }} | wc -l
when: iiab_wireless_lan_iface is defined and iiab_lan_iface == "br0" and hostapd_enabled when: iiab_wireless_lan_iface is defined and iiab_lan_iface == "br0" and hostapd_enabled
register: wifi_slave register: wifi_slave
- name: Restart hostapd if wifi slave is inactive - name: Restart hostapd if WiFi slave is inactive
service: name=hostapd.service service: name=hostapd.service
state=restarted state=restarted
when: wifi_slave.stdout is defined and hostapd_enabled and wifi_slave.stdout == 0 when: wifi_slave.stdout is defined and hostapd_enabled and wifi_slave.stdout == 0

View file

@ -66,14 +66,14 @@
ignore_errors: True ignore_errors: True
when: interface.changed when: interface.changed
- name: start up dhcpcd again - name: Start up dhcpcd again
service: name=dhcpcd state=started service: name=dhcpcd state=started
# now pick up denyinterfaces # now pick up denyinterfaces
- name: restart dhcpcd - name: Restart dhcpcd
service: name=dhcpcd state=restarted service: name=dhcpcd state=restarted
- name: restart the networking service - name: Restart the networking service
service: name=networking state=restarted service: name=networking state=restarted
#create lan br0 if lan_controller or gateway #create lan br0 if lan_controller or gateway

View file

@ -1,4 +1,4 @@
# Generated by XSCE # Generated by IIAB
NETWORKING=yes NETWORKING=yes
NETWORKING_IPV6=no NETWORKING_IPV6=no
IPV6FORWARDING=no IPV6FORWARDING=no

View file

@ -122,7 +122,7 @@
# following enables and disables # following enables and disables
- include_tasks: nextcloud_enabled.yml - include_tasks: nextcloud_enabled.yml
- name: Add Nextcloud to service list - name: Add 'nextcloud' to service list
ini_file: dest='{{ service_filelist }}' ini_file: dest='{{ service_filelist }}'
section=nextcloud section=nextcloud
option='{{ item.option }}' option='{{ item.option }}'

View file

@ -11,7 +11,7 @@
shell: if [ ! -d {{ wp_abs_path }} ]; then mv {{ wp_abs_path }}* {{ wp_abs_path }}; fi shell: if [ ! -d {{ wp_abs_path }} ]; then mv {{ wp_abs_path }}* {{ wp_abs_path }}; fi
# First pass at permissions and ownership # First pass at permissions and ownership
- name: Make apache owner and group - name: Make Apache owner and group
file: path={{ wp_abs_path }} file: path={{ wp_abs_path }}
recurse=yes recurse=yes
owner=root owner=root
@ -19,7 +19,7 @@
mode=0664 mode=0664
state=directory state=directory
- name: Make directories 775 so apache can traverse and write - name: Make directories 775 so Apache can traverse and write
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
@ -45,15 +45,15 @@
file: path=/tmp/get-iiab-wp-salts file: path=/tmp/get-iiab-wp-salts
state=absent state=absent
- name: mysql database needs to be running if we are trying to create a new db - name: MySQL database needs to be running if we are trying to create a new db
service: state=started service: state=started
name='{{ mysql_service }}' name='{{ mysql_service }}'
- name: Create mysql wordpress database - name: Create MySQL wordpress database
mysql_db: name={{ wp_db_name }} mysql_db: name={{ wp_db_name }}
state=present state=present
- name: Create mysql wordpress database user - name: Create MySQL wordpress database user
mysql_user: name={{ wp_db_user }} mysql_user: name={{ wp_db_user }}
password={{ wp_db_user_password }} password={{ wp_db_user_password }}
priv={{ wp_db_name }}.*:ALL,GRANT priv={{ wp_db_name }}.*:ALL,GRANT
@ -70,22 +70,21 @@
template: src=wordpress.conf.j2 template: src=wordpress.conf.j2
dest=/etc/{{ apache_config_dir }}/wordpress.conf dest=/etc/{{ apache_config_dir }}/wordpress.conf
- name: Enable httpd conf file if we are disabled - name: Enable httpd conf file if we are disabled (debuntu)
file: path=/etc/apache2/sites-enabled/wordpress.conf file: path=/etc/apache2/sites-enabled/wordpress.conf
src=/etc/apache2/sites-available/wordpress.conf src=/etc/apache2/sites-available/wordpress.conf
state=link state=link
when: wordpress_enabled and is_debuntu when: wordpress_enabled and is_debuntu
- name: Remove httpd conf file if we are disabled (OS's other than debuntu)
- name: Remove httpd conf file if we are disabled
file: path=/etc/apache2/sites-enabled/wordpress.conf file: path=/etc/apache2/sites-enabled/wordpress.conf
state=absent state=absent
when: not wordpress_enabled and is_debuntu when: not wordpress_enabled and is_debuntu
- name: Restart apache, so it picks up the new aliases - name: Restart Apache, so it picks up the new aliases
service: name={{ apache_service }} state=restarted service: name={{ apache_service }} state=restarted
- name: Add wordpress to service list - name: Add 'wordpress' to service list
ini_file: dest='{{ service_filelist }}' ini_file: dest='{{ service_filelist }}'
section=wordpress section=wordpress
option='{{ item.option }}' option='{{ item.option }}'