---

- name: Install configuration file.
  template:
    dest: /root/ingress-httpd.conf
    src: httpd.conf.j2
    owner: root
    mode: 0644

- name: Add ferm rule.
  template:
    dest: /etc/ferm.d/11-in-lockss-frontend.ferm
    src: 11-in-lockss-frontend.ferm.j2
    validate: ferm -n %s

- service:
    name: ferm
    state: restarted

- name: Remove ingress Docker container.
  command:
    cmd: docker rm -f apache
  ignore_errors: true

- name: Create ingress Docker container.
  command:
    cmd: docker run -d --rm
         --name apache
         -p 80:80
         --network host
         -v /root/ingress-httpd.conf:/usr/local/apache2/conf/httpd.conf
         httpd:2.4
