<commit_before>---
- name: client | generate ssh key for this machine
  shell: if [ -f {{ borgbackup_ssh_key }} ]; then rm -f {{ borgbackup_ssh_key }}; fi && ssh-keygen -q -t rsa -b 4096 -f {{ borgbackup_ssh_key }} -N "" creates="{{ borgbackup_ssh_key }}.pub"

- name: client | fetch ssh-key
  shell: "cat {{ borgbackup_ssh_key }}.pub"
  register: sshkey
  changed_when: False

- name: client | write passphrase
  lineinfile:
    dest: "/root/.borg.passphrase"
    state: "present"
    line: 'export BORG_PASSPHRASE="{{ borgbackup_passphrase }}"'
    create: "yes"

- name: client | disable strict key checking for backup servers
  blockinfile:
    dest: /root/.ssh/config
    create: yes
    marker: "### {mark} ANSIBLE MANAGED BLOCK {{ item.fqdn }} ###"
    content: |
      Host {{ item.fqdn }}
        StrictHostKeyChecking no
        {% if item.port is defined %}
        Port {{ item.port }}
        {% endif %}
  with_items: "{{ borgbackup_servers }}"

- name: client | put sshpubkey on the normal backupserver
  authorized_key:
    user: "{{ item.user }}"
    key: "{{ sshkey.stdout }}"
    key_options: 'command="cd {{ item.home }}{{ item.pool }}/{{ inventory_hostname }};borg serve {% if borgbackup_appendonly %}--append-only {% endif %}--restrict-to-path {{ item.home }}/{{ item.pool }}/{{ inventory_hostname }}",no-port-forwarding,no-X11-forwarding,no-pty,no-agent-forwarding,no-user-rc'
  delegate_to: "{{ item.fqdn }}"
  when: item.type == 'normal'
  with_items: "{{ borgbackup_servers }}"<commit_msg>specify what file to use for ssh<commit_after>---
- name: client | generate ssh key for this machine
  shell: if [ -f {{ borgbackup_ssh_key }} ]; then rm -f {{ borgbackup_ssh_key }}; fi && ssh-keygen -q -t rsa -b 4096 -f {{ borgbackup_ssh_key }} -N "" creates="{{ borgbackup_ssh_key }}.pub"

- name: client | fetch ssh-key
  shell: "cat {{ borgbackup_ssh_key }}.pub"
  register: sshkey
  changed_when: False

- name: client | write passphrase
  lineinfile:
    dest: "/root/.borg.passphrase"
    state: "present"
    line: 'export BORG_PASSPHRASE="{{ borgbackup_passphrase }}"'
    create: "yes"

- name: client | disable strict key checking for backup servers
  blockinfile:
    dest: /root/.ssh/config
    create: yes
    marker: "### {mark} ANSIBLE MANAGED BLOCK {{ item.fqdn }} ###"
    content: |
      Host {{ item.fqdn }}
        StrictHostKeyChecking no
        IdentityFile {{ borgbackup_ssh_key }}
        {% if item.port is defined %}
        Port {{ item.port }}
        {% endif %}
  with_items: "{{ borgbackup_servers }}"

- name: client | put sshpubkey on the normal backupserver
  authorized_key:
    user: "{{ item.user }}"
    key: "{{ sshkey.stdout }}"
    key_options: 'command="cd {{ item.home }}{{ item.pool }}/{{ inventory_hostname }};borg serve {% if borgbackup_appendonly %}--append-only {% endif %}--restrict-to-path {{ item.home }}/{{ item.pool }}/{{ inventory_hostname }}",no-port-forwarding,no-X11-forwarding,no-pty,no-agent-forwarding,no-user-rc'
  delegate_to: "{{ item.fqdn }}"
  when: item.type == 'normal'
  with_items: "{{ borgbackup_servers }}"
{'fraction_non_alphanumeric': 0.16219709208400646, 'fraction_numerical': 0.0038772213247172858, 'mean_word_length': 3.3544303797468356, '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': '77477', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1064, 'n_words': 262}