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

Merge pull request #462 from iiab/master

Sync from iiab/iiab:master
This commit is contained in:
A Holt 2021-02-01 17:32:49 -05:00 committed by GitHub
commit ac7842df6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 65 deletions

View file

@ -11,6 +11,5 @@ moodle_version: 310
moodle_repo_url: https://github.com/moodle/moodle.git moodle_repo_url: https://github.com/moodle/moodle.git
#moodle_repo_url: git://git.moodle.org/moodle.git # 2020-10-16: VERY Slow! #moodle_repo_url: git://git.moodle.org/moodle.git # 2020-10-16: VERY Slow!
moodle_base: "{{ iiab_base }}/moodle" # /opt/iiab moodle_base: "{{ iiab_base }}/moodle" # /opt/iiab
#moodle_user: moodle moodle_data: "{{ content_base }}/moodle" # /library
moodle_data: "{{ content_base }}/moodle" # /library/moodle
moodle_database_name: moodle 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 command: a2ensite 022-moodle.conf
when: moodle_enabled 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 command: a2dissite 022-moodle.conf
when: not moodle_enabled when: not moodle_enabled

View file

@ -18,14 +18,6 @@
name: postgresql 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) - name: Install 8 php packages (debuntu)
package: package:
name: name:
@ -40,22 +32,12 @@
state: present state: present
when: is_debuntu 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) - name: Does {{ moodle_base }}/config-dist.php exist? (indicating Moodle is/was installed)
stat: stat:
path: "{{ moodle_base }}/config-dist.php" path: "{{ moodle_base }}/config-dist.php" # /opt/iiab/moodle
register: 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: git:
repo: "{{ moodle_repo_url }}" repo: "{{ moodle_repo_url }}"
dest: "{{ moodle_base }}" dest: "{{ moodle_base }}"
@ -70,37 +52,36 @@
file: file:
state: directory state: directory
path: "{{ moodle_base }}" path: "{{ moodle_base }}"
owner: "{{ apache_user }}" owner: "{{ apache_user }}" # www-data
recurse: yes recurse: yes
- name: Create dir {{ content_base }}/dbdata/moodle owned by {{ apache_user }} - name: Create dir {{ content_base }}/dbdata/moodle owned by {{ apache_user }}
file: file:
state: directory state: directory
path: "{{ content_base }}/dbdata/moodle" path: "{{ content_base }}/dbdata/moodle" # /library
owner: "{{ apache_user }}" 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: file:
state: directory state: directory
path: "{{ moodle_data }}" path: "{{ moodle_data }}" # /library/moodle
owner: "{{ apache_user }}" owner: "{{ apache_user }}"
group: "{{ apache_user }}" group: "{{ apache_user }}"
mode: '0770' #mode: '0770' # Regardless, permissions end up as: drwxrwsrwx
- name: Remove stock /etc/{{ apache_conf_dir }}/moodle.conf - name: Remove stock /etc/{{ apache_conf_dir }}/moodle.conf
file: file:
path: "/etc/{{ apache_conf_dir }}/moodle.conf" path: "/etc/{{ apache_conf_dir }}/moodle.conf" # apache2/sites-available
state: absent state: absent
# 2021-02-01: Not nec if we can hopefully migrate from Apache to NGINX soon!
- name: Install /etc/{{ apache_conf_dir }}/022-moodle.conf from template - name: Install /etc/{{ apache_conf_dir }}/022-moodle.conf from template
template: template:
src: 022-moodle.j2 src: 022-moodle.j2
dest: "/etc/{{ apache_conf_dir }}/022-moodle.conf" 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 - name: Start 'postgresql-iiab' systemd service, to configure Moodle's DB
systemd: systemd:
name: postgresql-iiab name: postgresql-iiab
@ -136,8 +117,7 @@
systemd: systemd:
name: postgresql-iiab name: postgresql-iiab
state: restarted state: restarted
#enabled: yes #enabled: yes # Service ends up enabled regardless
#when: moodle_enabled
- name: (Re)Start '{{ apache_service }}' systemd service - name: (Re)Start '{{ apache_service }}' systemd service
systemd: systemd:
@ -153,11 +133,12 @@
shell: "{{ moodle_base }}/moodle_installer" shell: "{{ moodle_base }}/moodle_installer"
when: config.stat.exists is defined and not config.stat.exists when: config.stat.exists is defined and not config.stat.exists
- name: Make {{ moodle_base }}/config.php readable, with permission '0644' # 2021-02-01: Let's stick with Moodle's default (640)
#command: chown -R {{ apache_user }} {{ moodle_base }} #- name: Make {{ moodle_base }}/config.php readable, with permission '0644'
file: # #command: chown -R {{ apache_user }} {{ moodle_base }}
path: "{{ moodle_base }}/config.php" # /opt/iiab/moodle # file:
mode: '0644' # path: "{{ moodle_base }}/config.php" # /opt/iiab/moodle
# mode: '0644'
# RECORD Moodle AS INSTALLED # RECORD Moodle AS INSTALLED

View file

@ -24,27 +24,10 @@
when: moodle_installed is undefined when: moodle_installed is undefined
# - name: Enable 'postgresql-iiab' systemd service, if moodle_enabled - name: "Set 'postgresql_install: True' and 'postgresql_enabled: True'"
# 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: set_fact:
postgresql_install: True postgresql_install: True
postgresql_enabled: True postgresql_enabled: True # Revert just below if...
when: moodle_enabled
- name: "Set 'postgresql_enabled: False' if 'not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)'" - name: "Set 'postgresql_enabled: False' if 'not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)'"
set_fact: set_fact:
@ -56,14 +39,11 @@
name: postgresql name: postgresql
#- name: Enable/Disable/Restart Apache if primary
- name: SHIM FOR NOW SO ALWAYS DO THE...Enable/Disable/Restart Apache - name: SHIM FOR NOW SO ALWAYS DO THE...Enable/Disable/Restart Apache
include_tasks: apache.yml include_tasks: apache.yml
#when: not nginx_enabled
- name: Enable/Disable/Restart NGINX if primary - name: Enable/Disable/Restart NGINX
include_tasks: nginx.yml include_tasks: nginx.yml
when: nginx_enabled
- name: Add 'moodle' variable values to {{ iiab_ini_file }} - name: Add 'moodle' variable values to {{ iiab_ini_file }}
@ -77,7 +57,7 @@
value: Moodle value: Moodle
- option: description - option: description
value: '"Access the Moodle learning management system."' value: '"Access the Moodle learning management system."'
- option: "moodle_base" - option: moodle_base
value: "{{ moodle_base }}" value: "{{ moodle_base }}"
- option: moodle_enabled - option: moodle_enabled
value: "{{ moodle_enabled }}" value: "{{ moodle_enabled }}"