1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 19:22:24 +00:00

Moodle code cleanup

This commit is contained in:
root 2021-02-01 11:12:21 -05:00
parent b8311af03a
commit fcc7f73796
4 changed files with 18 additions and 55 deletions

View file

@ -11,6 +11,5 @@ moodle_version: 310
moodle_repo_url: https://github.com/moodle/moodle.git
#moodle_repo_url: git://git.moodle.org/moodle.git # 2020-10-16: VERY Slow!
moodle_base: "{{ iiab_base }}/moodle" # /opt/iiab
#moodle_user: moodle
moodle_data: "{{ content_base }}/moodle" # /library/moodle
moodle_data: "{{ content_base }}/moodle" # /library
moodle_database_name: moodle

View file

@ -1,8 +1,8 @@
- name: Enable http://box/moodle via Apache
- name: 'Enable http://box/moodle via Apache: create link /etc/apache2/sites-enabled/022-moodle.conf'
command: a2ensite 022-moodle.conf
when: moodle_enabled
- name: Disable http://box/moodle via Apache
- name: 'Disable http://box/moodle via Apache: remove link /etc/apache2/sites-enabled/022-moodle.conf'
command: a2dissite 022-moodle.conf
when: not moodle_enabled

View file

@ -18,14 +18,6 @@
name: postgresql
# - name: "Install packages: python-psycopg2, php-pgsql (OS's other than debuntu)"
# package:
# name:
# - python-psycopg2
# - php-pgsql
# state: present
# when: not is_debuntu
- name: Install 8 php packages (debuntu)
package:
name:
@ -40,22 +32,12 @@
state: present
when: is_debuntu
# - name: "Install package: php{{ php_version }}-zip (Ubuntu or Debian 9+)"
# package:
# name: "php{{ php_version }}-zip"
# when: is_ubuntu or (is_debian and not is_debian_8)
# - name: "Install package: php-pclzip (debian-8)"
# package:
# name: php-pclzip
# when: is_debian_8
- name: Does {{ moodle_base }}/config-dist.php exist? (indicating Moodle is/was installed)
stat:
path: "{{ moodle_base }}/config-dist.php"
path: "{{ moodle_base }}/config-dist.php" # /opt/iiab/moodle
register: moodle
- name: Clone (i.e. use git to download) {{ moodle_repo_url }} to {{ moodle_base }}
- name: Clone (i.e. use git to download) {{ moodle_repo_url }} to {{ moodle_base }} (~300 MB)
git:
repo: "{{ moodle_repo_url }}"
dest: "{{ moodle_base }}"
@ -78,29 +60,27 @@
state: directory
path: "{{ content_base }}/dbdata/moodle"
owner: "{{ apache_user }}"
# mode: '0755'
- name: Create dir {{ moodle_data }} ({{ apache_user }}:{{ apache_user }}, '0770') # /library/moodle
- name: Create dir {{ moodle_data }} ({{ apache_user }}:{{ apache_user }}, '0770')
file:
state: directory
path: "{{ moodle_data }}"
path: "{{ moodle_data }}" # /library/moodle
owner: "{{ apache_user }}"
group: "{{ apache_user }}"
mode: '0770'
#mode: '0770' # Regardless, permissions end up as: drwxrwsrwx
- name: Remove stock /etc/{{ apache_conf_dir }}/moodle.conf
file:
path: "/etc/{{ apache_conf_dir }}/moodle.conf"
path: "/etc/{{ apache_conf_dir }}/moodle.conf" # apache2/sites-available
state: absent
- name: Install /etc/{{ apache_conf_dir }}/022-moodle.conf from template
template:
src: 022-moodle.j2
dest: "/etc/{{ apache_conf_dir }}/022-moodle.conf"
# owner: root
# group: root
# mode: '0644'
# roles/postgresql/templates/postgresql-iiab.service WAS INSTALLED HERE:
# /etc/systemd/system/postgresql-iiab.service
- name: Start 'postgresql-iiab' systemd service, to configure Moodle's DB
systemd:
name: postgresql-iiab
@ -136,8 +116,7 @@
systemd:
name: postgresql-iiab
state: restarted
#enabled: yes
#when: moodle_enabled
#enabled: yes # Service ends up enabled regardless
- name: (Re)Start '{{ apache_service }}' systemd service
systemd:
@ -153,11 +132,12 @@
shell: "{{ moodle_base }}/moodle_installer"
when: config.stat.exists is defined and not config.stat.exists
- name: Make {{ moodle_base }}/config.php readable, with permission '0644'
#command: chown -R {{ apache_user }} {{ moodle_base }}
file:
path: "{{ moodle_base }}/config.php" # /opt/iiab/moodle
mode: '0644'
# 2021-02-01: Let's stick with Moodle's default (640)
#- name: Make {{ moodle_base }}/config.php readable, with permission '0644'
# #command: chown -R {{ apache_user }} {{ moodle_base }}
# file:
# path: "{{ moodle_base }}/config.php" # /opt/iiab/moodle
# mode: '0644'
# RECORD Moodle AS INSTALLED

View file

@ -24,22 +24,6 @@
when: moodle_installed is undefined
# - name: Enable 'postgresql-iiab' systemd service, if moodle_enabled
# systemd:
# name: postgresql-iiab
# deamon_reload: yes
# state: started
# enabled: yes
# when: moodle_enabled
#
# # if the only service using the backend db disable if not running
# - name: Disable 'postgresql-iiab' systemd service, if 'not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)'
# systemd:
# name: postgresql-iiab
# state: stopped
# enabled: no
# when: not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
- name: "Set 'postgresql_install: True' and 'postgresql_enabled: True' if moodle_enabled"
set_fact:
postgresql_install: True