<commit_before>- name: Make a copy of our undercloud for virthost installation
  hosts: virthost
  gather_facts: no
  any_errors_fatal: true
  vars:
      undercloud: "{{ hostvars[(groups.undercloud|first)].inventory_hostname }}"
      undercloud_image_file: "undercloud-quickstart-{{ hostvars[(groups.undercloud|first)].director_puddle_version | default(hostvars[(groups.undercloud|first)].core_puddle_version) }}.qcow2"
  tasks:
      - name: install package with virt-sparsify
        yum: name=libguestfs-tools-c state=present

      - name: shutdown the undercloud VM
        virt:
            name: "{{ undercloud }}"
            state: shutdown

      - name: wait for vm to be fully shut off
        shell: "virsh dominfo {{ undercloud }} | grep '^State: '"
        register: virsh_vm_status
        until: "'shut off' in virsh_vm_status.stdout"
        retries: 36  # * 5 = 3 minutes
        delay: 5

      - name: copy and shrink undercloud image
        shell: "virt-sparsify --compress /var/lib/libvirt/images/{{ undercloud }}-disk1.qcow2 {{ undercloud_image_file }}"

      - name: copy our auth key to the virthost
        copy:
            src: "{{ ansible_ssh_private_key_file | expanduser | realpath }}"
            dest: "~/backup_server_auth_key"
            mode: "0400"

      - name: copy our image to the backup server
        shell: "scp -o StrictHostKeyChecking=no -i ~/backup_server_auth_key {{ undercloud_image_file }} {{ private.storage.oc_image_repo.user }}@{{ private.storage.oc_image_repo.server }}:{{ private.storage.oc_image_repo.path }}/{{ (installer.product.core.version is defined and installer.product.core.version) | ternary(installer.product.core.version, installer.product.version) }}/{{ undercloud_image_file }}"

      # TODO(yfried): this should be in block/allways so cleanup is executed regardless of previous tasks
      - name: cleanup our files<commit_msg>UC qs/muffin backup - ignore target server ssh key<commit_after>- name: Make a copy of our undercloud for virthost installation
  hosts: virthost
  gather_facts: no
  any_errors_fatal: true
  vars:
      undercloud: "{{ hostvars[(groups.undercloud|first)].inventory_hostname }}"
      undercloud_image_file: "undercloud-quickstart-{{ hostvars[(groups.undercloud|first)].director_puddle_version | default(hostvars[(groups.undercloud|first)].core_puddle_version) }}.qcow2"
  tasks:
      - name: install package with virt-sparsify
        yum: name=libguestfs-tools-c state=present

      - name: shutdown the undercloud VM
        virt:
            name: "{{ undercloud }}"
            state: shutdown

      - name: wait for vm to be fully shut off
        shell: "virsh dominfo {{ undercloud }} | grep '^State: '"
        register: virsh_vm_status
        until: "'shut off' in virsh_vm_status.stdout"
        retries: 36  # * 5 = 3 minutes
        delay: 5

      - name: copy and shrink undercloud image
        shell: "virt-sparsify --compress /var/lib/libvirt/images/{{ undercloud }}-disk1.qcow2 {{ undercloud_image_file }}"

      - name: copy our auth key to the virthost
        copy:
            src: "{{ ansible_ssh_private_key_file | expanduser | realpath }}"
            dest: "~/backup_server_auth_key"
            mode: "0400"

      - name: copy our image to the backup server
        shell: "scp -o StrictHostKeyChecking=no -o PreferredAuthentications=publickey -o UserKnownHostsFile=/dev/null -i ~/backup_server_auth_key {{ undercloud_image_file }} {{ private.storage.oc_image_repo.user }}@{{ private.storage.oc_image_repo.server }}:{{ private.storage.oc_image_repo.path }}/{{ (installer.product.core.version is defined and installer.product.core.version) | ternary(installer.product.core.version, installer.product.version) }}/{{ undercloud_image_file }}"

      # TODO(yfried): this should be in block/allways so cleanup is executed regardless of previous tasks
      - name: cleanup our files
{'fraction_non_alphanumeric': 0.10926729640030636, 'fraction_numerical': 0.006127138115905029, 'mean_word_length': 3.2083780880773363, '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': '2550581', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1166, 'n_words': 304}