Ansible Create Users and Groups => Vault format unhexlify error

Hi all,

I am having some difficulties in completing the task Ansible Create Users and Groups. I must be missing a step along the way, but I cannot seem to figure out what that missing step is.

Here are the steps that I have taken so far:

# on jump host:
cd ~/playbooks

sudo vi ansible.cfg 
# add
[defaults]
inventory = ./inventory
remote_user = thor
host_key_checking = False
vault_password_file = ./secrets/vault.txt

# Create encrypted vault password for admins and developers
ansible-vault encrypt_string dCV3szSGNA  # admins
ansible-vault encrypt_string BruCStnMT5  # developers

sudo vi add_users.yml
# add
---
- hosts: stapp03
  become: yes
  gather_facts: no
  var_files:
    ./data/users.yml
  vars:
    admin_pass: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          33643631393238636638646531323837363631343464313834386365643936373630323034383761
          3437663763633434333230643132303136653664623736320a386232663335653332313737326230
          62386232316464653833346439316433613666643935363931653563333930643166356138643739
          3639663732643731380a623334326131643962316136383232396635643733623438626565373361
          6466
    developer_pass: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          61646235343139303338363333396362333265376261663832306266623063343361656436636664
          3532313233383234346465323436343362396339396336610a356232313937613362663661616537
          36343532393634323030343836356664663862366463613534323837353234633834663733343933
          3430666663623136340a356463393864366335326633623133343365653439396162373862646338
          3935
  tasks:
    - name: Create Groups
      group:
        name: "{{ item }}"
        state: present
      with_items: 
          - admins
          - developers
    - name: Include user.yml
      include_vars:
        file: data/users.yml
    - name: Create admins
      user:
        name: "{{ item }}"
        password: "{{ admin_pass | string | password_hash('sha512') }}"
        home: /home/devid
        groups: wheel, admins
      with_items: "{{ admins | list }}"
    - name: Create developers
      user:
        name: "{{ item }}"
        password: "{{ developer_pass | string | password_hash('sha512') }}"
        home: /var/www
        groups: developers
      with_items: "{{ admins | list }}"

# run playbook
sudo ansible-playbook -i inventory add_users.yml --vault-password-file=./secrets/vault.txt

Running the playbook generates this error:

[WARNING]: There was a vault format error: Vault format unhexlify error: Odd-length string fatal: [stapp02]: FAILED! => {"msg": "Vault format unhexlify error: Odd-length string"}

I am new to Ansible Vault and I am not sure how to proceed from here.

Thanks in advance to anyone who can help spot what I may be missing :slight_smile: