Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml syntax incorrect in debian tasks file #1

Open
jacquesbh opened this issue Jul 6, 2022 · 2 comments
Open

Yaml syntax incorrect in debian tasks file #1

jacquesbh opened this issue Jul 6, 2022 · 2 comments

Comments

@jacquesbh
Copy link

Hi!

Here is my issue:

Issue

I've got this error: Error: Module unable to decode valid JSON on stdin. Unable to figure out what parameters were passed

Here is the trace:

TASK [redirectionio.nginx_module : Install redirection.io repository] *************************************************************************************************************************
task path: /Users/jacques/Sites/website/resources/provisioning/roles/redirectionio.nginx_module/tasks/pkg-debian.yml:19
<51.15.200.201> ESTABLISH SSH CONNECTION FOR USER: root
<51.15.200.201> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/Users/jacques/.ansible/cp/0466a76521"' 51.15.200.201 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<51.15.200.201> (0, b'/root\n', b'')
<51.15.200.201> ESTABLISH SSH CONNECTION FOR USER: root
<51.15.200.201> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/Users/jacques/.ansible/cp/0466a76521"' 51.15.200.201 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1657100146.2553012-35561-167120051343552 `" && echo ansible-tmp-1657100146.2553012-35561-167120051343552="` echo /root/.ansible/tmp/ansible-tmp-1657100146.2553012-35561-167120051343552 `" ) && sleep 0'"'"''
<51.15.200.201> (0, b'ansible-tmp-1657100146.2553012-35561-167120051343552=/root/.ansible/tmp/ansible-tmp-1657100146.2553012-35561-167120051343552\n', b'')
Using module file /usr/local/Cellar/ansible/5.9.0/libexec/lib/python3.10/site-packages/ansible/modules/apt_repository.py
<51.15.200.201> PUT /Users/jacques/.ansible/tmp/ansible-local-34055f5kck70_/tmp36afou84 TO /root/.ansible/tmp/ansible-tmp-1657100146.2553012-35561-167120051343552/AnsiballZ_apt_repository.py
<51.15.200.201> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/Users/jacques/.ansible/cp/0466a76521"' '[51.15.200.201]'
<51.15.200.201> (0, b'sftp> put /Users/jacques/.ansible/tmp/ansible-local-34055f5kck70_/tmp36afou84 /root/.ansible/tmp/ansible-tmp-1657100146.2553012-35561-167120051343552/AnsiballZ_apt_repository.py\n', b'')
<51.15.200.201> ESTABLISH SSH CONNECTION FOR USER: root
<51.15.200.201> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/Users/jacques/.ansible/cp/0466a76521"' 51.15.200.201 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1657100146.2553012-35561-167120051343552/ /root/.ansible/tmp/ansible-tmp-1657100146.2553012-35561-167120051343552/AnsiballZ_apt_repository.py && sleep 0'"'"''
<51.15.200.201> (0, b'', b'')
<51.15.200.201> ESTABLISH SSH CONNECTION FOR USER: root
<51.15.200.201> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/Users/jacques/.ansible/cp/0466a76521"' -tt 51.15.200.201 '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp
/ansible-tmp-1657100146.2553012-35561-167120051343552/AnsiballZ_apt_repository.py && sleep 0'"'"''
<51.15.200.201> (1, b'\r\n{"msg": "Error: Module unable to decode valid JSON on stdin.  Unable to figure out what parameters were passed", "failed": true}\r\n', b'Shared connection to 51.15.2
00.201 closed.\r\n')
<51.15.200.201> Failed to connect to the host via ssh: Shared connection to 51.15.200.201 closed.
<51.15.200.201> ESTABLISH SSH CONNECTION FOR USER: root
<51.15.200.201> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
 PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/Users/jacques/.ansible/cp/0466a76521"' 51.15.200.201 '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tm
p-1657100146.2553012-35561-167120051343552/ > /dev/null 2>&1 && sleep 0'"'"''
<51.15.200.201> (0, b'', b'')
fatal: [website.fr]: FAILED! => {
    "changed": false,
    "msg": "Error: Module unable to decode valid JSON on stdin.  Unable to figure out what parameters were passed"
}
$ ansible --version
ansible [core 2.12.6]
  config file = /Users/jacques/Sites/website/resources/provisioning/ansible.cfg
  configured module search path = ['/Users/jacques/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/5.9.0/libexec/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/jacques/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.4 (main, Apr 26 2022, 19:42:59) [Clang 13.1.6 (clang-1316.0.21.2)]
  jinja version = 3.1.2
  libyaml = True

And the solution

--- a/resources/provisioning/roles/redirectionio.nginx_module/tasks/pkg-debian.yml
+++ b/resources/provisioning/roles/redirectionio.nginx_module/tasks/pkg-debian.yml
@@ -18,9 +18,7 @@

 - name: Install redirection.io repository
   apt_repository:
-    repo: >
-      deb {{ redirectionio_packages_url }}deb/{{ redirectionio_nginx_module_channel }}/{{ redirectionio_nginx_module_main_version }}
-      {{ ansible_distribution_release }} main
+    repo: deb {{ redirectionio_packages_url }}deb/{{ redirectionio_nginx_module_channel }}/{{ redirectionio_nginx_module_main_version }} {{ ansible_distribution_release }} main
     state: present
   when: redirectionio_nginx_module_main_version > 1
@lyrixx
Copy link
Member

lyrixx commented Jul 7, 2022

Hi, thanks for your feedback :)


This is weird, because the YAML is valid:

https://yaml-online-parser.appspot.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fredirectionio%2Fansible-libnginx-mod-redirectionio%2Fmaster%2Ftasks%2Fpkg-debian.yml

When you apply your patch everything is OK?

@xavierlacot
Copy link
Member

Thanks for the feedback.

Does this change work correctly? ⬇️

--- a/resources/provisioning/roles/redirectionio.nginx_module/tasks/pkg-debian.yml
+++ b/resources/provisioning/roles/redirectionio.nginx_module/tasks/pkg-debian.yml
@@ -18,9 +18,7 @@

 - name: Install redirection.io repository
   apt_repository:
-    repo: >
+    repo: >-
     deb {{ redirectionio_packages_url }}deb/{{ redirectionio_nginx_module_channel }}/{{ redirectionio_nginx_module_main_version }} {{ ansible_distribution_release }} main
     state: present
   when: redirectionio_nginx_module_main_version > 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants