1

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

paltaa
  • 2,985
  • 13
  • 28
  • I'm not able to reproduce the problem with the sample you've posted here. It looks like Ansible is complaining about the YAML structure of your playbook. Did you edit the file when booted into Windows? Any chance this is the result of a Windows vs Unix end-of-line issue? – larsks Aug 25 '20 at 15:55
  • I didnt touch the file in windows, they are even on separate ssd, added the information because is the only thing that did after it worked – paltaa Aug 25 '20 at 17:19
  • Also, just in case run a dos2unix on the playbook file but still it fails – paltaa Aug 25 '20 at 17:26
  • nvm was some ansible vars handling problem, removed the | urlencode and all works again – paltaa Aug 25 '20 at 17:37

1 Answers1

1

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

paltaa
  • 2,985
  • 13
  • 28