<commit_before>---
- block:

  - setup:

  - name: instala pacotes necessários para rodar containers
    apt:
      state: present
      install_recommends: no
      name:
        - debootstrap
        - systemd-container
        - zstd

  - name: cria diretório de configurações dos containers
    file:
      state: directory
      path: /etc/systemd/nspawn

  - name: cria configurações do container
    copy:
      content: "{{ nspawn_container_nspawn_config }}"
      dest: "/etc/systemd/nspawn/{{ nspawn_container_name }}.nspawn"
    register: conf

  - name: recarrega configurações systemd
    command:
      systemctl daemon-reload
    when: conf is changed

  - name: cria diretório do container
    file:
      path: "{{ nspawn_container_dir }}"
      state: directory

  - name: cria container a partir de imagem pré-definida
    unarchive:
      src: "{{ nspawn_container_image }}"
      creates: "{{ nspawn_container_dir }}/etc/.stage1-ok"
      dest: "{{ nspawn_container_dir }}"
      remote_src: yes

  - name: cria lock da imagem descompactada
    file:
      path: "{{ nspawn_container_dir }}/etc/.stage1.ok"
      state: touch

  - name: verifica se é necessário bootstrap
    stat:
      path: "{{ nspawn_container_dir }}/etc/.stage2.ok"<commit_msg>usa volume lógico lvm para cada container<commit_after>---
- block:

  - setup:

  - name: instala pacotes necessários para rodar containers
    apt:
      state: present
      install_recommends: no
      name:
        - debootstrap
        - systemd-container
        - zstd

  - name: cria diretório de configurações dos containers
    file:
      state: directory
      path: /etc/systemd/nspawn

  - name: cria configurações do container
    copy:
      content: "{{ nspawn_container_nspawn_config }}"
      dest: "/etc/systemd/nspawn/{{ nspawn_container_name }}.nspawn"
    register: conf

  - name: recarrega configurações systemd
    command:
      systemctl daemon-reload
    when: conf is changed

  - name: cria volume lvm do container
    lvol:
      lv: "{{ nspawn_container_name }}"
      size: "{{ nspawn_container_lvm_lv_size }}"
      state: present
      vg: "{{ nspawn_container_lvm_vg }}"

  - name: "formata o volume lvm do container"
    filesystem:
      dev: "/dev/{{ nspawn_container_lvm_vg }}/{{ nspawn_container_name }}"
      fstype: "ext4"

  - name: "configura montagem do volume em fstab"
    mount:
      fstype: "ext4"
      src: "/dev/{{ nspawn_container_lvm_vg }}/{{ nspawn_container_name }}"
      path: "{{ nspawn_container_dir }}"
      state: mounted

  - name: cria container a partir de imagem pré-definida
    unarchive:
      src: "{{ nspawn_container_image }}"
      creates: "{{ nspawn_container_dir }}/etc/.stage1-ok"
      dest: "{{ nspawn_container_dir }}"
      remote_src: yes

  - name: cria lock da imagem descompactada
    file:
      path: "{{ nspawn_container_dir }}/etc/.stage1.ok"
      state: touch

  - name: verifica se é necessário bootstrap
    stat:
      path: "{{ nspawn_container_dir }}/etc/.stage2.ok"
{'fraction_non_alphanumeric': 0.10467412771560237, 'fraction_numerical': 0.0026333113890717576, 'mean_word_length': 2.5837264150943398, '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': '6416621', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1023, 'n_words': 254}