1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Update main.yml

This commit is contained in:
A Holt 2018-10-31 03:10:26 -04:00 committed by GitHub
parent 5d2c4327fc
commit ce6c22d16e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,21 +46,21 @@
#ignore_errors: yes #ignore_errors: yes
when: internet_available and moodle.stat.exists is defined and not moodle.stat.exists when: internet_available and moodle.stat.exists is defined and not moodle.stat.exists
- name: Prepare the downloaded directory so Apache can install config file - name: Create dir {{ moodle_base }} owned by {{ apache_user }} (for config file?)
file: file:
path: "{{ moodle_base }}" path: "{{ moodle_base }}"
owner: "{{ apache_user }}" owner: "{{ apache_user }}"
recurse: yes recurse: yes
state: directory state: directory
- name: Give Apache permission to write Moodle data directory - name: Create dir {{ content_base }}/dbdata/moodle owned by {{ apache_user }} with write permission 0755
file: file:
path: "{{ content_base }}/dbdata/moodle" path: "{{ content_base }}/dbdata/moodle"
owner: "{{ apache_user }}" owner: "{{ apache_user }}"
mode: 0755 mode: 0755
state: directory state: directory
- name: Create a Moodle data dir with Apache permission to write - name: Create dir {{ moodle_data }} owned by {{ apache_user }}:{{ apache_user }} with write permission 0770 # /library/moodle
file: file:
path: "{{ moodle_data }}" path: "{{ moodle_data }}"
owner: "{{ apache_user }}" owner: "{{ apache_user }}"
@ -73,7 +73,7 @@
path: "/etc/{{ apache_config_dir }}/moodle.conf" path: "/etc/{{ apache_config_dir }}/moodle.conf"
state: absent state: absent
- name: Install Apache's 022-moodle.conf from template - name: Install Apache's 022-moodle.conf from template, if moodle_enabled
template: template:
src: 022-moodle.j2 src: 022-moodle.j2
dest: "/etc/{{ apache_config_dir }}/022-moodle.conf" dest: "/etc/{{ apache_config_dir }}/022-moodle.conf"
@ -82,25 +82,25 @@
mode: 0644 mode: 0644
when: moodle_enabled when: moodle_enabled
- name: Create symlink 022-moodle.conf from sites-enabled to sites-available (debuntu) - name: Create symlink 022-moodle.conf from sites-enabled to sites-available, if moodle_enabled (debuntu)
file: file:
src: /etc/apache2/sites-available/022-moodle.conf src: /etc/apache2/sites-available/022-moodle.conf
dest: /etc/apache2/sites-enabled/022-moodle.conf dest: /etc/apache2/sites-enabled/022-moodle.conf
state: link state: link
when: moodle_enabled and is_debuntu when: moodle_enabled and is_debuntu
- name: Remove symlink 022-moodle.conf (debuntu) - name: Remove symlink 022-moodle.conf, if not moodle_enabled (debuntu)
file: file:
path: /etc/apache2/sites-enabled/022-moodle.conf path: /etc/apache2/sites-enabled/022-moodle.conf
state: absent state: absent
when: not moodle_enabled and is_debuntu when: not moodle_enabled and is_debuntu
- name: Start postgresql-iiab - name: Restart postgresql-iiab
service: service:
name: postgresql-iiab name: postgresql-iiab
state: restarted state: restarted
- name: Create db user - name: Create PostgreSQL db user Admin/changeme
postgresql_user: postgresql_user:
name: Admin name: Admin
password: changeme password: changeme
@ -110,7 +110,7 @@
become: yes become: yes
become_user: postgres become_user: postgres
- name: Create database - name: 'Create database: {{ moodle_database_name }}'
postgresql_db: postgresql_db:
name: "{{ moodle_database_name }}" name: "{{ moodle_database_name }}"
encoding: utf8 encoding: utf8
@ -120,42 +120,42 @@
become: yes become: yes
become_user: postgres become_user: postgres
- name: Put moodle_installer script in {{ moodle_base }} - name: Install {{ moodle_base }}/moodle_installer from template
template: template:
dest: "{{ moodle_base }}"
src: moodle_installer src: moodle_installer
dest: "{{ moodle_base }}"
mode: 0755 mode: 0755
- name: Restart postgresql-iiab - name: Enable & Restart postgresql-iiab
service: service:
name: postgresql-iiab name: postgresql-iiab
state: restarted state: restarted
enabled: yes enabled: yes
when: moodle_enabled when: moodle_enabled
- name: Restart Apache - name: Restart Apache ({{ apache_service }})
service: service:
name: "{{ apache_service }}" name: "{{ apache_service }}"
state: restarted state: restarted
- name: See if {{ moodle_base }}/config.php exists - name: Does {{ moodle_base }}/config.php exist?
stat: stat:
path: "{{ moodle_base }}/config.php" path: "{{ moodle_base }}/config.php"
register: config register: config
- name: Execute moodle_installer script - name: Execute {{ moodle_base }}/moodle_installer
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: Give Apache permission to read {{ moodle_base }}/config.php - name: Give read permission 0644 to {{ moodle_base }}/config.php # /opt/iiab/moodle/config.php
#command: chown -R {{ apache_user }} {{ moodle_base }} #command: chown -R {{ apache_user }} {{ moodle_base }}
file: file:
path: "{{ moodle_base }}/config.php" path: "{{ moodle_base }}/config.php"
mode: 0644 mode: 0644
- name: Add 'moodle' to list of services at {{ iiab_ini_file }} - name: Add 'moodle' variable values to {{ iiab_ini_file }}
ini_file: ini_file:
dest: "{{ iiab_ini_file }}" path: "{{ iiab_ini_file }}"
section: moodle section: moodle
option: "{{ item.option }}" option: "{{ item.option }}"
value: "{{ item.value }}" value: "{{ item.value }}"