<commit_before>---
- name: Wait for all Tor hidden services hostname files.
  wait_for:
    state: present
    path: "{{ tor_hidden_services_parent_dir }}/{{ item.service }}/hostname"
    delay: 5
  with_items: tor_instances
  tags:
    - tor

- name: Collect Tor hidden service hostnames.
  command: cat /var/lib/tor/services/{{ item.service }}/hostname
  register: tor_hidden_service_hostname_lookup
  # Read-only task, so don't report changed.
  changed_when: false
  with_items: tor_instances
  tags:
    - tor
    - admin

  # The results of the multiple `cat` commands above are stored
  # in a list, and can be iterated over when writing via the `copy` module.
  # The cat-then-copy approach allows formatting the config lines prior
  # to writing, therefore ensuring idempotence, so the task only reports
  # changed if the contents have indeed changed.
- name: Write Tor hidden service hostname files to Admin Workstation.
  local_action:
    module: copy
    dest: ./{{ item.item.filename }}
    # The `content` parameter does not automatically append a newline, so
    # force adding one. Doing so ensures that the resulting files can be
    # concatenated into the torrc.
    content: "HidServAuth {{ item.stdout }}\\n"
  # Local action, so we don't want elevated privileges
  sudo: no
  with_items: tor_hidden_service_hostname_lookup.results
  tags:
    - tor
    - admin

<commit_msg>Fixes fetching Source Interface THS URL<commit_after>---
- name: Wait for all Tor hidden services hostname files.
  wait_for:
    state: present
    path: "{{ tor_hidden_services_parent_dir }}/{{ item.service }}/hostname"
    delay: 5
  with_items: tor_instances
  tags:
    - tor

- name: Collect Tor hidden service hostnames.
  command: cat /var/lib/tor/services/{{ item.service }}/hostname
  register: tor_hidden_service_hostname_lookup
  # Read-only task, so don't report changed.
  changed_when: false
  with_items: tor_instances
  tags:
    - tor
    - admin

  # The results of the multiple `cat` commands above are stored
  # in a list, and can be iterated over when writing via the `copy` module.
  # The cat-then-copy approach allows formatting the config lines prior
  # to writing, therefore ensuring idempotence, so the task only reports
  # changed if the contents have indeed changed.
- name: Write Tor hidden service hostname files to Admin Workstation.
  local_action:
    module: copy
    dest: ./{{ item.item.filename }}
    # The `content` parameter does not automatically append a newline, so
    # force adding one. Doing so ensures that the resulting files can be
    # concatenated into the torrc. We also only want the "HidServAuth"
    # string for ATHS URLs, but not for THS urls.
    content: "{% if item.item.filename.endswith('-aths') %}HidServAuth {% endif %}{{ item.stdout }}\\n"
  # Local action, so we don't want elevated privileges
  sudo: no
  with_items: tor_hidden_service_hostname_lookup.results
  tags:
    - tor
    - admin


{'fraction_non_alphanumeric': 0.08265856950067477, 'fraction_numerical': 0.0006747638326585695, 'mean_word_length': 3.3991097922848663, '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': '5714679', 'n_tokens_mistral': 886, 'n_tokens_neox': 865, 'n_words': 341}