<commit_before>---
- name: load vaulted variables
  include_vars: vars/vault.yml

- name: copy ad html snippets
  copy:
    src: "{{item}}"
    dest: "/tmp/ads/"
  with_items:
    - amazon.html
    - paypal_gift.html

# Forum server
- name: stop forum container
  docker_container:
    name: forum
    state: absent
  ignore_errors: yes
  register: container_stop
  until: not container_stop.get("failed")
  retries: 5
  delay: 10
- name: launch forum container
  docker_container:
    name: forum
    image: "{{forum_image}}:{{version}}"
    pull: yes
    state: started
    networks:
      - name: "{{project_name}}"
        aliases:
          - forum
    env:
      HOSTNAME: "{{inventory_hostname}}"
      DB_NAME: "{{db_name}}"
      DB_USER: "{{db_user}}"
      DB_PASSWORD: "{{db_password}}"
      AWS_STORAGE_BUCKET_NAME: "{{aws_storage_bucket_name}}"
      AWS_ACCESS_KEY_ID: "{{aws_access_key_id}}"
      AWS_SECRET_ACCESS_KEY: "{{aws_secret_access_key}}"
      EMAIL_HOST: "{{email_host}}"
      EMAIL_PORT: "{{email_port}}"
      SERVER_EMAIL: "{{server_email}}"  # email address to use
      EMAIL_HOST_PASSWORD: "{{email_host_password}}"
      EMAIL_SERVER_PREFIX: "{{email_server_prefix}}"
      ADMIN_NAME: "{{admin_name}}"
      ADMIN_EMAIL: "{{admin_email}}"
    volumes:
      - /tmp/ads:/app/templates/ads/:ro

# Websocket server
- name: stop websocket container
  docker_container:
    name: websocket
    state: absent
  ignore_errors: yes
  register: container_stop
  until: not container_stop.get("failed")
  retries: 5
  delay: 10
- name: launch websocket container
  docker_container:
    name: websocket
    image: "{{websocket_image}}:{{version}}"
    pull: yes
    state: started
    networks:
      - name: "{{project_name}}"
        aliases:
          - websocket
...<commit_msg>feat(ansible): Add django clearsessions cron<commit_after>---
- name: load vaulted variables
  include_vars: vars/vault.yml

- name: copy ad html snippets
  copy:
    src: "{{item}}"
    dest: "/tmp/ads/"
  with_items:
    - amazon.html
    - paypal_gift.html

# Forum server
- name: stop forum container
  docker_container:
    name: forum
    state: absent
  ignore_errors: yes
  register: container_stop
  until: not container_stop.get("failed")
  retries: 5
  delay: 10
- name: launch forum container
  docker_container:
    name: forum
    image: "{{forum_image}}:{{version}}"
    pull: yes
    state: started
    networks:
      - name: "{{project_name}}"
        aliases:
          - forum
    env:
      HOSTNAME: "{{inventory_hostname}}"
      DB_NAME: "{{db_name}}"
      DB_USER: "{{db_user}}"
      DB_PASSWORD: "{{db_password}}"
      AWS_STORAGE_BUCKET_NAME: "{{aws_storage_bucket_name}}"
      AWS_ACCESS_KEY_ID: "{{aws_access_key_id}}"
      AWS_SECRET_ACCESS_KEY: "{{aws_secret_access_key}}"
      EMAIL_HOST: "{{email_host}}"
      EMAIL_PORT: "{{email_port}}"
      SERVER_EMAIL: "{{server_email}}"  # email address to use
      EMAIL_HOST_PASSWORD: "{{email_host_password}}"
      EMAIL_SERVER_PREFIX: "{{email_server_prefix}}"
      ADMIN_NAME: "{{admin_name}}"
      ADMIN_EMAIL: "{{admin_email}}"
    volumes:
      - /tmp/ads:/app/templates/ads/:ro

# Websocket server
- name: stop websocket container
  docker_container:
    name: websocket
    state: absent
  ignore_errors: yes
  register: container_stop
  until: not container_stop.get("failed")
  retries: 5
  delay: 10
- name: launch websocket container
  docker_container:
    name: websocket
    image: "{{websocket_image}}:{{version}}"
    pull: yes
    state: started
    networks:
      - name: "{{project_name}}"
        aliases:
          - websocket

# Crons
- name: add clearsession cron
  cron:
    name: django clearsessions
    job: docker exec forum python3 manage.py clearsessions
    hour: 4
    minute: 0
...
{'fraction_non_alphanumeric': 0.1263765076035658, 'fraction_numerical': 0.003932878867330886, 'mean_word_length': 3.1021505376344085, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6328637', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1320, 'n_words': 294}