<commit_before>---
# This role installs and configures Apache and Nginx

- name: install Apache and Nginx configure Apache
  become: true
  apt:
    pkg: "{{ item }}"
    state: installed
  with_items:
    - apache2
    - libapache2-mod-rpaf
    - libapache2-mod-wsgi

- name: remove default Apache site
  become: true
  file:
    path: /etc/apache2/sites-enabled/000-default.conf
    state: absent

- name: Apache listen on port 8080
  become: true
  lineinfile:
    dest: /etc/apache2/ports.conf
    regexp: "^Listen 80"
    line: "Listen 8080"
    state: present

- name: copy Apache vhost configuration
  become: true
  template:
    src: config/apache2_ckan_default
    dest: /etc/apache2/sites-available/ckan_default.conf
    mode: 664
    owner: root

- name: enable Apache vhost
  become: true
  file:
    src: /etc/apache2/sites-available/ckan_default.conf
    dest: /etc/apache2/sites-enabled/ckan_default.conf
    state: link

- name: restart Apache
  become: true
  service:
    name: apache2
    state: restarted

# Must happen after apache is configured
- name: install Nginx
  become: true
  apt:
    name: nginx
    state: installed

- name: add Launchpad's key ID
  become: true
  apt_key:
    keyserver: keyserver.ubuntu.com
    id: <KEY>

- name: add certbot PPA
  become: true
  apt_repository:
    repo: 'ppa:certbot/certbot'
    update_cache: true

- name: install certbot
  become: true
  apt:
    pkg: python-certbot-nginx
    state: installed

- name: generate cert with Lets Encrypt
  become: true
  command: "certbot certonly --nginx -n -d {{ domain }} --agree-tos -m support@<EMAIL>"

- name: copy nginx config
  become: true
  template:
    src: config/nginx_ckan
    dest: /etc/nginx/sites-available/ckan
    mode: 0644
    owner: root

- name: deactivate default nginx site
  become: true<commit_msg>Use the python 3 certbot which does not need to have a ppa added<commit_after>---
# This role installs and configures Apache and Nginx

- name: install Apache and Nginx configure Apache
  become: true
  apt:
    pkg: "{{ item }}"
  with_items:
    - apache2
    - libapache2-mod-rpaf
    - libapache2-mod-wsgi

- name: remove default Apache site
  become: true
  file:
    path: /etc/apache2/sites-enabled/000-default.conf
    state: absent

- name: Apache listen on port 8080
  become: true
  lineinfile:
    dest: /etc/apache2/ports.conf
    regexp: "^Listen 80"
    line: "Listen 8080"
    state: present

- name: copy Apache vhost configuration
  become: true
  template:
    src: config/apache2_ckan_default
    dest: /etc/apache2/sites-available/ckan_default.conf
    mode: 664
    owner: root

- name: enable Apache vhost
  become: true
  file:
    src: /etc/apache2/sites-available/ckan_default.conf
    dest: /etc/apache2/sites-enabled/ckan_default.conf
    state: link

- name: restart Apache
  become: true
  service:
    name: apache2
    state: restarted

# Must happen after apache is configured
- name: install Nginx
  become: true
  apt:
    name: nginx

- name: add Launchpad's key ID
  become: true
  apt_key:
    keyserver: keyserver.ubuntu.com
    id: <KEY>

- name: install certbot
  become: true
  apt:
    pkg: python3-certbot-nginx
    update_cache: true

- name: generate cert with Lets Encrypt
  become: true
  command: "certbot certonly --nginx -n -d {{ domain }} --agree-tos -m <EMAIL>"

- name: copy nginx config
  become: true
  template:
    src: config/nginx_ckan
    dest: /etc/nginx/sites-available/ckan
    mode: 0644
    owner: root

- name: deactivate default nginx site
  become: true
{'fraction_non_alphanumeric': 0.09259780467210808, 'fraction_numerical': 0.017450042217844075, 'mean_word_length': 2.867247007616975, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7044518', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1220, 'n_words': 369}