<commit_before>---
- hosts: localhost
  tasks:
    - hashivault_init:
      register: 'vault_init'
    - block:
      - assert: { that: "{{vault_init.rc}} == 0" }
      when: "vault_init.changed == False"
    - block:
      - assert: { that: "'keys' in vault_init" }
      - assert: { that: "'root_token' in vault_init" }
      - assert: { that: "{{vault_init.rc}} == 0" }
      - set_fact:
          vault_keys: "{{vault_init['keys'] | join(' ')}}"
      - hashivault_unseal:
          keys: '{{vault_keys}}'
        register: 'vault_unseal'
      - assert: { that: "{{vault_unseal.changed}} == True" }
      - assert: { that: "{{vault_unseal.status.progress}} == 0" }
      - assert: { that: "{{vault_unseal.status.sealed}} == False" }
      - assert: { that: "{{vault_unseal.rc}} == 0" }
      - debug:
          msg: export VAULT_TOKEN='{{vault_init['root_token']}}'
      - debug:
          msg: export VAULT_KEYS='{{vault_init['keys'] | join(' ')}}'
      when: "vault_init.changed == True"
<commit_msg>write keys and tokens to file<commit_after>---
- hosts: localhost
  tasks:
    - hashivault_init:
        secret_shares: 1
        secret_threshold: 1
      register: 'vault_init'
    - block:
      - assert: { that: "{{vault_init.rc}} == 0" }
      when: "vault_init.changed == False"
    - block:
      - assert: { that: "'keys' in vault_init" }
      - assert: { that: "'root_token' in vault_init" }
      - assert: { that: "{{vault_init.rc}} == 0" }
      - set_fact:
          vault_keys: "{{vault_init['keys'] | join(' ')}}"
      - hashivault_unseal:
          keys: '{{vault_keys}}'
        register: 'vault_unseal'
      - assert: { that: "{{vault_unseal.changed}} == True" }
      - assert: { that: "{{vault_unseal.status.progress}} == 0" }
      - assert: { that: "{{vault_unseal.status.sealed}} == False" }
      - assert: { that: "{{vault_unseal.rc}} == 0" }
      - copy:
          dest: "./vaultenv.sh"
          mode: 0700
          content: "export VAULT_TOKEN='{{vault_init['root_token']}}'\nexport VAULT_KEYS='{{vault_init['keys'] | join(' ')}}'"
      when: "vault_init.changed == True"

{'fraction_non_alphanumeric': 0.19045368620037806, 'fraction_numerical': 0.006616257088846881, 'mean_word_length': 2.4311183144246353, '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': '5866621', 'n_tokens_mistral': 788, 'n_tokens_neox': 773, 'n_words': 144}