<commit_before>---
- name: Add group {{ profile_fpm_user }}
  group:
    name: "{{ profile_fpm_user }}"
    state: present

- name: Add user {{ profile_fpm_user }}
  user:
    name: "{{ profile_fpm_user }}"
    group: "{{ profile_fpm_user }}"
    createhome: no
    state: present

- name: Create directory for vhosts to store PHP sessions
  file:
    path: "{{ php_session_dir}}/profile"
    state: directory
    owner: "{{ profile_fpm_user }}"
    group: root
    mode: 0770

- name: Include install-release.yml
  include: install-release.yml
  when: profile_branch is not defined or profile_branch == ''

- name: Include install-branch.yml
  include: install-branch.yml
  when: profile_branch is defined and profile_branch != ''

- name: Create the cache dir for Symfony
  file:
    path: "{{ profile_symfony_cache_path }}"
    state: directory
    owner: "{{ profile_fpm_user }}"
    group: "{{ profile_fpm_user }}"
    recurse: yes

- name: Create the log dir for Symfony
  file:
    path: "{{ profile_symfony_log_path }}"
    state: directory
    owner: "{{ profile_fpm_user }}"
    group: '{{ profile_fpm_user }}'
    recurse: yes

- name: Place parameters.yaml
  template:
    src: "{{ item }}.j2"
    dest: "{{ profile_current_release_symlink }}/config/legacy/{{ item }}"
    mode: 0644
  with_items:
    - parameters.yaml

- name: Instantiate global_view_parameters.yml.dist
  command: mv global_view_parameters.yaml.dist global_view_parameters.yaml
  args:
    chdir: "{{ profile_current_release_symlink }}/config/legacy/"
    creates: "{{ profile_current_release_symlink }}/config/legacy/global_view_parameters.yaml"

- name: Check presence of language specific overrides
  local_action: stat path="{{ inventory_dir }}/files/profile/overrides/"
  register: overrides_present
  become: false

# Can be removed after 2022-01-01
- name: Check for wrongly created overrides file (not dir)
  stat:
    path: "{{ profile_current_release_symlink }}/translations/overrides"
  register: overridesisfile

# Can be removed after 2022-01-01
- name: Clean up wrongly created overrides file (not dir)
  file:
    path: "{{ profile_current_release_symlink }}/translations/overrides"
    state: absent
  when: overrides_present.stat.exists and not overridesisfile.stat.isdir

- name: Copy language specific overrides
  template:
    src: "{{ item }}"
    dest: "{{ profile_current_release_symlink }}/translations/overrides/"
  when: overrides_present.stat.exists
  with_fileglob:
    - "{{ inventory_dir }}/files/profile/overrides/*"
  notify:
    - "restart php72-fpm"

- name: Check if we have a custom favicon
  local_action: stat path="{{ inventory_dir }}/files/favicon.ico"
  register: customfavicon
  become: false

- name: Install environment specific favicon
  copy:
    src: "{{ inventory_dir }}/files/favicon.ico"
    dest: "{{ profile_current_release_symlink }}/public/"
  when:
    customfavicon.stat.exists

- name: Create the symfony cache
  command: php72 bin/console cache:clear --env={{ profile_apache_symfony_environment }} --no-debug
  args:
    chdir: "{{ profile_current_release_symlink }}/"
  when:
    - not develop
  changed_when: false

- name: Make sure cache dir has correct permissions
  file:
    path: "{{ profile_current_release_symlink }}/var/cache"
    owner: "{{ profile_fpm_user }}"
    group: "{{ profile_fpm_user }}"
    recurse: yes
  changed_when: false

- name: Make sure log dir has correct permissions
  file:
    path: "{{ profile_current_release_symlink }}/var/log"
    owner: "{{ profile_fpm_user }}"
    group: "{{ profile_fpm_user }}"
    recurse: yes
  changed_when: false

- name: Install Apache vhost
  template:
    src: "{{ item }}.j2"
    dest: "/etc/httpd/conf.d/{{ item }}"
  with_items:
    - profile.conf
  notify:
    - "restart httpd"

- name: clean up old php-fpm 5.6 config
  file:
    path: "/etc/php-fpm.d/profile-pool.conf"
    state: absent

- name: php-fpm 72 config
  template:
    src: "{{ item }}.j2"
    dest: "/etc/opt/remi/php72/php-fpm.d/{{ item }}"
  with_items:
     - profile-pool-72.conf
  notify:
    - "restart php72-fpm"

- name: clean up profile <3.0 config
  file:
    path: "/etc/openconext/profile.yml"
    state: absent

- name: Include the role manage_provision_entities to provision profile to Manage
  include_role: 
    name: manage_provision_entities
  vars: 
    entity_type: saml20_sp

# Remove all dirs, but keep the current version and from the rest the most recent one.
- name: Clean up old releases
  shell: ls -td {{ openconext_releases_dir }}/OpenConext-profile-* | grep -v $(readlink {{ profile_current_release_symlink }}) | tail -n +2 | xargs --no-run-if-empty rm -rv
  register: clean_releases
  changed_when: '"removed" in clean_releases.stdout'

# Remove all tarballs, but keep the current version and from the rest the most recent one.
- name: Clean up old builds
  shell: ls -td {{ openconext_builds_dir }}/OpenConext-profile-* {{ openconext_builds_dir }}/Releases/ | grep -v {{ profile_build_path }} | tail -n +2 | xargs --no-run-if-empty rm -rv
  register: clean_builds
  changed_when: '"removed" in clean_builds.stdout'
<commit_msg>Zo dan<commit_after>---
- name: Add group {{ profile_fpm_user }}
  group:
    name: "{{ profile_fpm_user }}"
    state: present

- name: Add user {{ profile_fpm_user }}
  user:
    name: "{{ profile_fpm_user }}"
    group: "{{ profile_fpm_user }}"
    createhome: no
    state: present

- name: Create directory for vhosts to store PHP sessions
  file:
    path: "{{ php_session_dir}}/profile"
    state: directory
    owner: "{{ profile_fpm_user }}"
    group: root
    mode: 0770

- name: Include install-release.yml
  include: install-release.yml
  when: profile_branch is not defined or profile_branch == ''

- name: Include install-branch.yml
  include: install-branch.yml
  when: profile_branch is defined and profile_branch != ''

- name: Create the cache dir for Symfony
  file:
    path: "{{ profile_symfony_cache_path }}"
    state: directory
    owner: "{{ profile_fpm_user }}"
    group: "{{ profile_fpm_user }}"
    recurse: yes

- name: Create the log dir for Symfony
  file:
    path: "{{ profile_symfony_log_path }}"
    state: directory
    owner: "{{ profile_fpm_user }}"
    group: '{{ profile_fpm_user }}'
    recurse: yes

- name: Place parameters.yaml
  template:
    src: "{{ item }}.j2"
    dest: "{{ profile_current_release_symlink }}/config/legacy/{{ item }}"
    mode: 0644
  with_items:
    - parameters.yaml

- name: Instantiate global_view_parameters.yml.dist
  command: mv global_view_parameters.yaml.dist global_view_parameters.yaml
  args:
    chdir: "{{ profile_current_release_symlink }}/config/legacy/"
    creates: "{{ profile_current_release_symlink }}/config/legacy/global_view_parameters.yaml"

- name: Check presence of language specific overrides
  local_action: stat path="{{ inventory_dir }}/files/profile/overrides/"
  register: overrides_present
  become: false

# Can be removed after 2022-01-01
- name: Check for wrongly created overrides file (not dir)
  stat:
    path: "{{ profile_current_release_symlink }}/translations/overrides"
  register: overridesisfile

# Can be removed after 2022-01-01
- name: Clean up wrongly created overrides file (not dir)
  file:
    path: "{{ profile_current_release_symlink }}/translations/overrides"
    state: absent
  when: overrides_present.stat.exists and overridesisfile.stat.exists and overridesisfile.stat.isdir == False

- name: Copy language specific overrides
  template:
    src: "{{ item }}"
    dest: "{{ profile_current_release_symlink }}/translations/overrides/"
  when: overrides_present.stat.exists
  with_fileglob:
    - "{{ inventory_dir }}/files/profile/overrides/*"
  notify:
    - "restart php72-fpm"

- name: Check if we have a custom favicon
  local_action: stat path="{{ inventory_dir }}/files/favicon.ico"
  register: customfavicon
  become: false

- name: Install environment specific favicon
  copy:
    src: "{{ inventory_dir }}/files/favicon.ico"
    dest: "{{ profile_current_release_symlink }}/public/"
  when:
    customfavicon.stat.exists

- name: Create the symfony cache
  command: php72 bin/console cache:clear --env={{ profile_apache_symfony_environment }} --no-debug
  args:
    chdir: "{{ profile_current_release_symlink }}/"
  when:
    - not develop
  changed_when: false

- name: Make sure cache dir has correct permissions
  file:
    path: "{{ profile_current_release_symlink }}/var/cache"
    owner: "{{ profile_fpm_user }}"
    group: "{{ profile_fpm_user }}"
    recurse: yes
  changed_when: false

- name: Make sure log dir has correct permissions
  file:
    path: "{{ profile_current_release_symlink }}/var/log"
    owner: "{{ profile_fpm_user }}"
    group: "{{ profile_fpm_user }}"
    recurse: yes
  changed_when: false

- name: Install Apache vhost
  template:
    src: "{{ item }}.j2"
    dest: "/etc/httpd/conf.d/{{ item }}"
  with_items:
    - profile.conf
  notify:
    - "restart httpd"

- name: clean up old php-fpm 5.6 config
  file:
    path: "/etc/php-fpm.d/profile-pool.conf"
    state: absent

- name: php-fpm 72 config
  template:
    src: "{{ item }}.j2"
    dest: "/etc/opt/remi/php72/php-fpm.d/{{ item }}"
  with_items:
     - profile-pool-72.conf
  notify:
    - "restart php72-fpm"

- name: clean up profile <3.0 config
  file:
    path: "/etc/openconext/profile.yml"
    state: absent

- name: Include the role manage_provision_entities to provision profile to Manage
  include_role: 
    name: manage_provision_entities
  vars: 
    entity_type: saml20_sp

# Remove all dirs, but keep the current version and from the rest the most recent one.
- name: Clean up old releases
  shell: ls -td {{ openconext_releases_dir }}/OpenConext-profile-* | grep -v $(readlink {{ profile_current_release_symlink }}) | tail -n +2 | xargs --no-run-if-empty rm -rv
  register: clean_releases
  changed_when: '"removed" in clean_releases.stdout'

# Remove all tarballs, but keep the current version and from the rest the most recent one.
- name: Clean up old builds
  shell: ls -td {{ openconext_builds_dir }}/OpenConext-profile-* {{ openconext_builds_dir }}/Releases/ | grep -v {{ profile_build_path }} | tail -n +2 | xargs --no-run-if-empty rm -rv
  register: clean_builds
  changed_when: '"removed" in clean_builds.stdout'

{'fraction_non_alphanumeric': 0.11861774412735392, 'fraction_numerical': 0.0091244418559503, 'mean_word_length': 3.581147176522899, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2107155', 'n_tokens_mistral': 3529, 'n_tokens_neox': 3434, 'n_words': 923}