---
- block:
  - name: Install the shibbolet packages
    apt: pkg={{ shibbolet_pkg_list }} state={{ shibbolet_pkg_state }} cache_valid_time=1800 update_cache=yes
    when: is_not_trusty

  - name: Install the shibbolet packages on Trusty
    apt: pkg={{ shibbolet_pkg_list_trusty }} state={{ shibbolet_pkg_state }} cache_valid_time=1800 update_cache=yes
    when: is_not_trusty

  - name: Install the shibbolet apache module
    apt: pkg={{ shibbolet_apache_module_pkg }} state={{ shibbolet_pkg_state }} cache_valid_time=1800 update_cache=yes

  - name: Enable the apache shib2 module
    apache2_module: name=shib2 state=present
    notify: apache2 reload

  - name: Create the shibbolet log directory
    file: dest=/var/log/shibbolet state=directory owner='_shibd' group='_shibd'

  - name: Ensure that the shibd service is running and enabled
    service: name=shibd state=started enabled=yes

  tags: [ 'shibboleth', 'shibbolet_sp' ]