Search code examples
gitansibleansible-vault

Ansible task with git module fails with ' and could not be converted to an dict.The error was: need more than 1 value to unpack\n'


been developing a simple ansible-playbook, one of the tasks is to run a git pull to a folder, yesterday it was working perfectly, committed and then rebooted mi pc to windows (from ubuntu).

After rebooting with ubuntu again and running the playbook I started encountering weird errors, first a ssh to localhost from a delegate_to: localhost task couldn't ssh and fixed by adding [local] block to the inventory.

Now the git pull task fails with errors:

fatal: [127.0.0.1]: FAILED! => {
    "msg": "the field 'args' has an invalid value ({u'repo': u'https://{{ github_user | urlencode }}:{{ github_password | urlencode }}@github.com/{{ repo_url }}.git', u'dest': u'{{ local_build_path }}/freedom_integration_ant'}), and could not be converted to an dict.The error was: need more than 1 value to unpack\n\nThe error appears to be in '/home/jquiroga/Documents/rokketlabs/freedom_customer_deployment/deploy_tuggers.yaml': line 15, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Get updated files from git repository\n      ^ here\n"
}

Which doesn't tell me much information (even checked with - debug: var=vars and the var is being passed alright the task is:

- name: Get updated files from git repository
  git:
    repo: "https://{{ github_user | urlencode }}:{{ github_password | urlencode }}@github.com/{{ repo_url }}.git"
    dest: "{{ local_build_path }}/my_repo"
  delegate_to: localhost

github_password is encrypted with ansible vault and I'm running the script with --ask-vault-pass


Solution

  • The {{ github_user | urlencode }} and {{ github_password | urlencode }} was causing issues, removing | urlencode from vars fixed the issue.