diff --git a/README.md b/README.md index 3ab5afe..6f89656 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,6 @@ An Ansible role that installs [Crayfish](https://github.com/Islandora-CLAW/Crayf Available variables are listed below, along with default values: ``` -# User to install crayfish with (usually the webserver user) -crayfish_user: www-data -crayfish_group: www-data # Crayfish version to install crayfish_version_tag: 0.0.7 # Crayfish services to install @@ -30,7 +27,15 @@ crayfish_log_dir: /var/log/islandora # Apache configuration directory crayfish_apache_conf_dir: /etc/apache2 ``` +Some OS dependent variables are set in vars/* but can be overridden if desired: +``` +# crayfish_user: www-data +# httpd_conf_directory: /etc/apache2 +# crayfish_packages: +# - ImageMagick +``` +======= `crayfish_db` can be set to: - pgsql - mysql @@ -41,6 +46,10 @@ There are lots more configuration settings in [defaults/main.yml](defaults/main. ## Dependencies +* Apache webserver +* PHP 7 + +======= The module depends on the following. Links are provided to roles known to work with the mdoule, but should be able to work with any role providing the required software: * [Apache](https://galaxy.ansible.com/geerlingguy/apache/) * [PHP](https://galaxy.ansible.com/geerlingguy/php/) diff --git a/defaults/main.yml b/defaults/main.yml index 2ccf9c0..65d693d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,4 +1,3 @@ -crayfish_user: www-data crayfish_version_tag: 0.0.8 crayfish_services: @@ -6,7 +5,7 @@ crayfish_services: - Houdini - Milliner - Hypercube - + crayfish_install_dir: /var/www/html/Crayfish crayfish_syn_token: islandora @@ -90,3 +89,8 @@ crayfish_milliner_db_options: user: "{{ crayfish_db_user }}" password: "{{ crayfish_db_password }}" +# OS Dependent variables set in vars can be overridden here +# crayfish_user: www-data +# httpd_conf_directory: /etc/apache2 +# crayfish_packages: +# - ImageMagick diff --git a/tasks/install.yml b/tasks/install.yml index 1bff231..d29e667 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -1,16 +1,15 @@ --- -- name: Install requisite package repositories +- name: Add ImageMagick repo (apt) apt_repository: repo: 'ppa:lyrasis/imagemagick-jp2' + when: ansible_os_family == "Debian" - name: Install requisite packages - apt: - name: "{{item}}" + package: + name: "{{ item }}" state: present - with_items: - - tesseract-ocr - - imagemagick + with_items: "{{ crayfish_packages }}" - name: Install crayfish code git: @@ -31,7 +30,7 @@ with_items: "{{ crayfish_services }}" - name: Get SSL keys - include_role: + include_role: name: Islandora-Devops.keymaster vars: ssl_key_public_output_path: "{{ crayfish_install_dir }}/public.key" @@ -46,22 +45,34 @@ file: path: /var/log/islandora state: directory - owner: www-data - group: www-data - mode: "u+rwx,g+r,o-rwx" + owner: "{{ crayfish_user }}" + group: "{{ crayfish_user }}" + mode: "urwx,gr,o-rwx" + +- name: Create httpd config directories + file: + path: "{{httpd_conf_directory}}/{{ item }}/" + state: directory + owner: "{{ crayfish_user }}" + group: "{{ crayfish_user }}" + mode: "urwx,gr,o-rwx" + with_items: + - "conf-available" + - "conf-enabled" + when: ansible_os_family == "RedHat" - name: Install crayfish httpd config file template: src: "httpd/{{item}}.conf.j2" - dest: "/etc/apache2/conf-available/{{item}}.conf" + dest: "{{httpd_conf_directory}}/conf-available/{{item}}.conf" owner: "{{ crayfish_user }}" group: "{{ crayfish_user }}" with_items: "{{ crayfish_services }}" - name: Symlink crayfish httpd config file into action file: - src: "/etc/apache2/conf-available/{{item}}.conf" - dest: "/etc/apache2/conf-enabled/{{item}}.conf" + src: "{{httpd_conf_directory}}/conf-available/{{item}}.conf" + dest: "{{httpd_conf_directory}}/conf-enabled/{{item}}.conf" owner: "{{ crayfish_user }}" group: "{{ crayfish_user }}" state: link diff --git a/tasks/main.yml b/tasks/main.yml index 0873ce1..9dcac21 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,23 @@ --- +- name: Include OS-specific variables + include_vars: "{{ ansible_os_family}}.yml" + +- name: Define crayfish_user + set_fact: + crayfish_user: "{{ __crayfish_user }}" + when: crayfish_user is not defined + +- name: Define httpd_conf_directory + set_fact: + httpd_conf_directory: "{{ __httpd_conf_directory }}" + when: httpd_conf_directory is not defined + +- name: Define OS-specific crayfish_packages to install + set_fact: + crayfish_packages: "{{ __crayfish_packages }}" + when: crayfish_packages is not defined + - include: db-mysql.yml tags: - crayfish diff --git a/vars/Debian.yml b/vars/Debian.yml new file mode 100644 index 0000000..f745111 --- /dev/null +++ b/vars/Debian.yml @@ -0,0 +1,6 @@ +--- + +__crayfish_user: www-data +__httpd_conf_directory: /etc/apache2 +__crayfish_packages: + - imagemagick diff --git a/vars/RedHat.yml b/vars/RedHat.yml new file mode 100644 index 0000000..40a1e20 --- /dev/null +++ b/vars/RedHat.yml @@ -0,0 +1,6 @@ +--- + +__crayfish_user: apache +__httpd_conf_directory: /etc/httpd +__crayfish_packages: + - ImageMagick