From ce6c22d16e565a050107aee54e5ca54bda26df0c Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 31 Oct 2018 03:10:26 -0400 Subject: [PATCH] Update main.yml --- roles/moodle/tasks/main.yml | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/roles/moodle/tasks/main.yml b/roles/moodle/tasks/main.yml index 2a5554493..ce468b2c7 100644 --- a/roles/moodle/tasks/main.yml +++ b/roles/moodle/tasks/main.yml @@ -46,21 +46,21 @@ #ignore_errors: yes 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: path: "{{ moodle_base }}" owner: "{{ apache_user }}" recurse: yes 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: path: "{{ content_base }}/dbdata/moodle" owner: "{{ apache_user }}" mode: 0755 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: path: "{{ moodle_data }}" owner: "{{ apache_user }}" @@ -73,7 +73,7 @@ path: "/etc/{{ apache_config_dir }}/moodle.conf" state: absent -- name: Install Apache's 022-moodle.conf from template +- name: Install Apache's 022-moodle.conf from template, if moodle_enabled template: src: 022-moodle.j2 dest: "/etc/{{ apache_config_dir }}/022-moodle.conf" @@ -82,25 +82,25 @@ mode: 0644 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: src: /etc/apache2/sites-available/022-moodle.conf dest: /etc/apache2/sites-enabled/022-moodle.conf state: link 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: path: /etc/apache2/sites-enabled/022-moodle.conf state: absent when: not moodle_enabled and is_debuntu -- name: Start postgresql-iiab +- name: Restart postgresql-iiab service: name: postgresql-iiab state: restarted -- name: Create db user +- name: Create PostgreSQL db user Admin/changeme postgresql_user: name: Admin password: changeme @@ -110,7 +110,7 @@ become: yes become_user: postgres -- name: Create database +- name: 'Create database: {{ moodle_database_name }}' postgresql_db: name: "{{ moodle_database_name }}" encoding: utf8 @@ -120,42 +120,42 @@ become: yes become_user: postgres -- name: Put moodle_installer script in {{ moodle_base }} +- name: Install {{ moodle_base }}/moodle_installer from template template: - dest: "{{ moodle_base }}" src: moodle_installer + dest: "{{ moodle_base }}" mode: 0755 -- name: Restart postgresql-iiab +- name: Enable & Restart postgresql-iiab service: name: postgresql-iiab state: restarted enabled: yes when: moodle_enabled -- name: Restart Apache +- name: Restart Apache ({{ apache_service }}) service: name: "{{ apache_service }}" state: restarted -- name: See if {{ moodle_base }}/config.php exists +- name: Does {{ moodle_base }}/config.php exist? stat: path: "{{ moodle_base }}/config.php" register: config -- name: Execute moodle_installer script - shell: '{{ moodle_base }}/moodle_installer' +- name: Execute {{ moodle_base }}/moodle_installer + shell: {{ moodle_base }}/moodle_installer 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 }} file: path: "{{ moodle_base }}/config.php" mode: 0644 -- name: Add 'moodle' to list of services at {{ iiab_ini_file }} +- name: Add 'moodle' variable values to {{ iiab_ini_file }} ini_file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" section: moodle option: "{{ item.option }}" value: "{{ item.value }}"