---
  - name: Install prerequisites for operating Apache2 over https
    apt: name={{ item }} update_cache=yes state=latest
    loop: [ 'python3-certbot-apache' ]

  #- name: Set up Apache2 virtualhost
  #  template:
  #    src: "files/gs3-apache.conf.j2"
  #    dest: "/etc/apache2/sites-available/{{ apache2_revproxy_config.config_root_name }}.conf"

  #- name: Adjusting Greenstone3 installations index.html to work in Apache2 DocumentRoot
  #  ansible.builtin.replace:
  #    path:   "{{ gsdl3srchome }}/web/index.html"
  #    regexp:  'href="(?!http://|/)'
  #    replace: 'href="/{{ gsdl3servlet_external.context }}/'


#    - name: "UFW - Allow HTTPS on port {{ gsdl3servlet_external.port | default('443',true) }}"
#      ufw:
#        rule: allow
#        port: "{{ gsdl3servlet_external.port | default('443',true) }}"
#        proto: tcp
#      when gsdl3servlet_external.protocol == "https"

##
# ???? Open up Port 80, and assume there is a config rule for rewriting to HTTPS port ??
##
#    - name: "UFW - Allow HTTP on port 80"
#      ufw:
#        rule: allow
#        port: 80
#        proto: tcp
#      when gsdl3servlet_external.protocol == "https"

