<commit_before>---

  # If creds_dir var is passed, then we don't need to create a temp dir
  - name: Create a temp dir for local permissions file
    local_action: shell mktemp -d
    always_run: yes # run during check mode
    when: (creds_dir is not defined) or (creds_dir | trim == '')
    run_once: yes
    register: mktemp
    notify: clean mktemp
    tags:
      - nginx
      - configuration
      - plugin
      - permissions
      - permissions-sync
      - permissions-gen

  - name: Assign credentials temp dir if not passed through
    set_fact:
      creds_dir: "{{ mktemp.stdout }}"
    when: (creds_dir is not defined) or (creds_dir | trim == '')
    become: yes
    tags:
      - install
      - nginx
      - configuration
      - plugin
      - permissions
      - permissions-sync
      - permissions-gen

  - debug: msg="Created a temp dir. If the playbook fails, please delete this directory using -> rm -r {{ creds_dir }}"
    when: auth_permissions_gspreadsheets is defined and not(auth_permissions_gspreadsheets | trim == '')
    always_run: yes # run during check mode
    run_once: yes
    tags:
      - configuration
      - plugin
      - permissions
      - permissions-sync
      - permissions-gen
      - nginx

  - name: Create directories which need to exist if necessary
    file: path={{ item }} state=directory owner=root
    with_items:
    - "{{ nginx_conf_dir }}"
    become: yes
    tags:
      - configuration
      - plugin
      - permissions
      - permissions-sync
      - permissions-gen
      - nginx

  - name: Generate oauth file from template when auth_permissions_gspreadsheets is true
    when: auth_permissions_gspreadsheets is defined and not(auth_permissions_gspreadsheets | trim == '')
    local_action: template src=oauth.j2 dest="{{ creds_dir }}/oauth" mode=0600<commit_msg>Changed local action to delegate module<commit_after>---

  # If creds_dir var is passed, then we don't need to create a temp dir
  - name: Create a temp dir for local permissions file
    shell: mktemp -d
    delegate_to: 127.0.0.1
    always_run: yes # run during check mode
    when: (creds_dir is not defined) or (creds_dir | trim == '')
    run_once: yes
    register: mktemp
    notify: clean mktemp
    tags:
      - nginx
      - configuration
      - plugin
      - permissions
      - permissions-sync
      - permissions-gen

  - name: Assign credentials temp dir if not passed through
    set_fact:
      creds_dir: "{{ mktemp.stdout }}"
    when: (creds_dir is not defined) or (creds_dir | trim == '')
    become: yes
    tags:
      - install
      - nginx
      - configuration
      - plugin
      - permissions
      - permissions-sync
      - permissions-gen

  - debug: msg="Created a temp dir. If the playbook fails, please delete this directory using -> rm -r {{ creds_dir }}"
    when: auth_permissions_gspreadsheets is defined and not(auth_permissions_gspreadsheets | trim == '')
    always_run: yes # run during check mode
    run_once: yes
    tags:
      - configuration
      - plugin
      - permissions
      - permissions-sync
      - permissions-gen
      - nginx

  - name: Create directories which need to exist if necessary
    file: path={{ item }} state=directory owner=root
    with_items:
    - "{{ nginx_conf_dir }}"
    become: yes
    tags:
      - configuration
      - plugin
      - permissions
      - permissions-sync
      - permissions-gen
      - nginx

  - name: Generate oauth file from template when auth_permissions_gspreadsheets is true
    when: auth_permissions_gspreadsheets is defined and not(auth_permissions_gspreadsheets | trim == '')
    template: src=oauth.j2 dest="{{ creds_dir }}/oauth" mode=0644
    delegate_to: 127.0.0.1
{'fraction_non_alphanumeric': 0.08436324556689952, 'fraction_numerical': 0.005910800644814616, 'mean_word_length': 2.396897810218978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '5103327', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1085, 'n_words': 354}