<commit_before>---
- name: "Create the installation directory {{ dynatrace_client_linux_install_dir }}"
  file:
    path: "{{ dynatrace_client_linux_install_dir }}"
    state: directory
  register: dynatrace_client_create_install_dir_result
  become: yes

- name: Change ownership of the installation directory if it had to be created
  file:
    path: "{{ dynatrace_client_linux_install_dir }}"
    owner: "{{ dynatrace_client_owner }}"
    group: "{{ dynatrace_client_group }}"
  when: dynatrace_client_create_install_dir_result | changed
  become: yes

- name: "Copy the Dynatrace installer to {{ dynatrace_client_linux_install_dir }} if the installer is provided locally"
  copy:
    src: "{{ playbook_dir }}/roles/{{ dynatrace_client_role_name }}/files/linux/{{ dynatrace_client_linux_installer_file_name }}"
    dest: "{{ dynatrace_client_linux_install_dir }}"
  when: dynatrace_client_installer_file_provided.stat.exists
  become: yes

- name: "Download the Dynatrace installer to {{ dynatrace_client_linux_install_dir }} if the installer is not provided locally"
  get_url:
    url: "{{ dynatrace_client_linux_installer_file_url }}"
    dest: "{{ dynatrace_client_linux_install_dir }}"
  when: not dynatrace_client_installer_file_provided.stat.exists
  become: yes

- name: Copy the Dynatrace Client installer script to /tmp
  template:
    src: templates/linux/run-dynatrace-client-installer.sh.j2
    dest: /tmp/run-dynatrace-client-installer.sh

- name: Install the Dynatrace Client
  shell: /bin/bash /tmp/run-dynatrace-client-installer.sh
  become: yes

- name: Gather the name of the installation directory
  shell: find . -maxdepth 1 -name dynatrace-\* -type d -printf '%T@ %p\n' | sort -k 1nr | cut -d' ' -f2 | head -1
  args:
    chdir: "{{ dynatrace_client_linux_install_dir }}"
  register: dynatrace_client_installed_version_dir
  become: yes

- name: Change ownership of the installation directory
  file:
    path: "{{ dynatrace_client_linux_install_dir }}/{{ dynatrace_client_installed_version_dir.stdout }}"
    owner: "{{ dynatrace_client_owner }}"
    group: "{{ dynatrace_client_group }}"
    state: directory
    recurse: yes
  become: yes

- name: Change mode of the installation directory
  file:
    path: "{{ dynatrace_client_linux_install_dir }}/{{ dynatrace_client_installed_version_dir.stdout }}"
    mode: 0755
  become: yes

- name: "Create a symlink of the actual installation directory to {{ dynatrace_client_linux_install_dir }}/dynatrace"
  file:
    src: "{{ dynatrace_client_linux_install_dir }}/{{ dynatrace_client_installed_version_dir.stdout }}"
    dest: "{{ dynatrace_client_linux_install_dir }}/dynatrace"
    owner: "{{ dynatrace_client_owner }}"
    group: "{{ dynatrace_client_group }}"
    mode: 0755
    state: link
  become: yes

- name: Remove the Dynatrace Client installer
  file:
    path: "{{ dynatrace_client_linux_install_dir }}/{{ dynatrace_client_linux_installer_file_name }}"
    state: absent<commit_msg>JLT-185277 Implicitly set mode for folder structure<commit_after>---
- name: "Create the installation directory {{ dynatrace_client_linux_install_dir }}"
  file:
    path: "{{ dynatrace_client_linux_install_dir }}"
    state: directory
  register: dynatrace_client_create_install_dir_result
  become: yes

- name: Change ownership of the installation directory if it had to be created
  file:
    path: "{{ dynatrace_client_linux_install_dir }}"
    owner: "{{ dynatrace_client_owner }}"
    group: "{{ dynatrace_client_group }}"
  when: dynatrace_client_create_install_dir_result | changed
  become: yes

- name: "Copy the Dynatrace installer to {{ dynatrace_client_linux_install_dir }} if the installer is provided locally"
  copy:
    src: "{{ playbook_dir }}/roles/{{ dynatrace_client_role_name }}/files/linux/{{ dynatrace_client_linux_installer_file_name }}"
    dest: "{{ dynatrace_client_linux_install_dir }}"
  when: dynatrace_client_installer_file_provided.stat.exists
  become: yes

- name: "Download the Dynatrace installer to {{ dynatrace_client_linux_install_dir }} if the installer is not provided locally"
  get_url:
    url: "{{ dynatrace_client_linux_installer_file_url }}"
    dest: "{{ dynatrace_client_linux_install_dir }}"
  when: not dynatrace_client_installer_file_provided.stat.exists
  become: yes

- name: Copy the Dynatrace Client installer script to /tmp
  template:
    src: templates/linux/run-dynatrace-client-installer.sh.j2
    dest: /tmp/run-dynatrace-client-installer.sh

- name: Install the Dynatrace Client
  shell: /bin/bash /tmp/run-dynatrace-client-installer.sh
  become: yes

- name: Gather the name of the installation directory
  shell: find . -maxdepth 1 -name dynatrace-\* -type d -printf '%T@ %p\n' | sort -k 1nr | cut -d' ' -f2 | head -1
  args:
    chdir: "{{ dynatrace_client_linux_install_dir }}"
  register: dynatrace_client_installed_version_dir
  become: yes

- name: Change ownership of the installation directory
  file:
    path: "{{ dynatrace_client_linux_install_dir }}/{{ dynatrace_client_installed_version_dir.stdout }}"
    owner: "{{ dynatrace_client_owner }}"
    group: "{{ dynatrace_client_group }}"
    state: directory
    recurse: yes
  become: yes

- name: Change mode of the installation directory
  file:
    path: "{{ dynatrace_client_linux_install_dir }}/{{ dynatrace_client_installed_version_dir.stdout }}"
    mode: 0775
  become: yes

- name: "Create a symlink of the actual installation directory to {{ dynatrace_client_linux_install_dir }}/dynatrace"
  file:
    src: "{{ dynatrace_client_linux_install_dir }}/{{ dynatrace_client_installed_version_dir.stdout }}"
    dest: "{{ dynatrace_client_linux_install_dir }}/dynatrace"
    owner: "{{ dynatrace_client_owner }}"
    group: "{{ dynatrace_client_group }}"
    mode: 0775
    state: link
  become: yes

- name: Remove the Dynatrace Client installer
  file:
    path: "{{ dynatrace_client_linux_install_dir }}/{{ dynatrace_client_linux_installer_file_name }}"
    state: absent
{'fraction_non_alphanumeric': 0.10090361445783133, 'fraction_numerical': 0.00535475234270415, 'mean_word_length': 4.660037878787879, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4369485', 'n_tokens_mistral': 2019, 'n_tokens_neox': 1984, 'n_words': 457}