{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/1077","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/1077/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/1077/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/1077/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/1077","id":66205564,"number":1077,"title":"Shell module: \"a duplicate parameter was found in the argument string ()\"","user":{"login":"rlpowell","id":35904,"avatar_url":"https://avatars.githubusercontent.com/u/35904?v=3","gravatar_id":"","url":"https://api.github.com/users/rlpowell","html_url":"https://github.com/rlpowell","followers_url":"https://api.github.com/users/rlpowell/followers","following_url":"https://api.github.com/users/rlpowell/following{/other_user}","gists_url":"https://api.github.com/users/rlpowell/gists{/gist_id}","starred_url":"https://api.github.com/users/rlpowell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlpowell/subscriptions","organizations_url":"https://api.github.com/users/rlpowell/orgs","repos_url":"https://api.github.com/users/rlpowell/repos","events_url":"https://api.github.com/users/rlpowell/events{/privacy}","received_events_url":"https://api.github.com/users/rlpowell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/affects_2.0","name":"affects_2.0","color":"5319e7"},{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/waiting_on_maintainer","name":"waiting_on_maintainer","color":"d93f0b"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2015-04-03T18:39:16Z","updated_at":"2016-10-24T12:28:16Z","closed_at":null,"body":"I apologize that I don't have the background with Ansible or Python to give any useful debugging info here, but:\r\n\r\nTrying to run a shell command and get the output presented to me.  This\r\nversion:\r\n\r\n    - name: run the script the rails way\r\n      register: scriptrun\r\n      shell: 'uname -a'\r\n  \r\n    - name: get the result back\r\n      fetch: src=/tmp/mismatch_visne.csv dest=/tmp/mismatch_visne/\r\n  \r\n    # Print the shell task's stdout.\r\n    - debug: msg={{ scriptrun.stdout }}\r\n\r\nWorks fine:\r\n\r\n    TASK: [run the script the rails way] ******************************************\r\n    changed: [perf-sedna_tomcat-1-tomcat]\r\n    changed: [qa-rhea_tomcat-1-tomcat]\r\n    changed: [qa-ariel_tomcat-1-tomcat]\r\n    changed: [perf-dione_tomcat-1-tomcat]\r\n    \r\n    TASK: [get the result back] ***************************************************\r\n    ok: [perf-sedna_tomcat-1-tomcat]\r\n    ok: [qa-rhea_tomcat-1-tomcat]\r\n    ok: [qa-ariel_tomcat-1-tomcat]\r\n    ok: [perf-dione_tomcat-1-tomcat]\r\n    \r\n    TASK: [debug msg={{ scriptrun.stdout }}] **************************************\r\n    ok: [perf-sedna_tomcat-1-tomcat] => {\r\n        \"msg\": \"Linux\"\r\n    }\r\n    ok: [qa-ariel_tomcat-1-tomcat] => {\r\n        \"msg\": \"Linux\"\r\n    }\r\n    ok: [qa-rhea_tomcat-1-tomcat] => {\r\n        \"msg\": \"Linux\"\r\n    }\r\n    ok: [perf-dione_tomcat-1-tomcat] => {\r\n        \"msg\": \"Linux\"\r\n    }\r\n    \r\n    PLAY RECAP ********************************************************************\r\n               to retry, use: --limit @/home/rlpowell/cyt_2407.yaml.retry\r\n    \r\n    perf-dione_tomcat-1-tomcat : ok=6    changed=1    unreachable=0    failed=0\r\n    perf-sedna_tomcat-1-tomcat : ok=6    changed=1    unreachable=0    failed=0\r\n    qa-ariel_tomcat-1-tomcat   : ok=6    changed=1    unreachable=0    failed=0\r\n    qa-janus_tomcat-1-tomcat   : ok=0    changed=0    unreachable=1    failed=0\r\n    qa-rhea_tomcat-1-tomcat    : ok=6    changed=1    unreachable=0    failed=0\r\n\r\n\r\nOTOH, this one (the only change is to the \"shell:\" param):\r\n\r\n    - name: run the script the rails way\r\n      register: scriptrun\r\n      shell: '/usr/local/bin/cytobank_rails runner /tmp/cyt_2407.rb'\r\n  \r\n    - name: get the result back\r\n      fetch: src=/tmp/mismatch_visne.csv dest=/tmp/mismatch_visne/\r\n  \r\n    # Print the shell task's stdout.\r\n    - debug: msg={{ scriptrun.stdout }}\r\n\r\nGives this output:\r\n\r\n    TASK: [run the script the rails way] ******************************************\r\n    changed: [perf-sedna_tomcat-1-tomcat]\r\n    changed: [qa-ariel_tomcat-1-tomcat]\r\n    changed: [perf-dione_tomcat-1-tomcat]\r\n    changed: [qa-rhea_tomcat-1-tomcat]\r\n    \r\n    TASK: [get the result back] ***************************************************\r\n    ok: [qa-rhea_tomcat-1-tomcat]\r\n    ok: [qa-ariel_tomcat-1-tomcat]\r\n    ok: [perf-sedna_tomcat-1-tomcat]\r\n    ok: [perf-dione_tomcat-1-tomcat]\r\n    \r\n    TASK: [debug msg={{ scriptrun.stdout }}] **************************************\r\n    fatal: [perf-dione_tomcat-1-tomcat] => a duplicate parameter was found in the argument string ()\r\n    fatal: [qa-ariel_tomcat-1-tomcat] => a duplicate parameter was found in the argument string ()\r\n    fatal: [perf-sedna_tomcat-1-tomcat] => a duplicate parameter was found in the argument string ()\r\n    fatal: [qa-rhea_tomcat-1-tomcat] => a duplicate parameter was found in the argument string ()\r\n    \r\n    FATAL: all hosts have already failed -- aborting\r\n    \r\n    PLAY RECAP ********************************************************************\r\n               to retry, use: --limit @/home/rlpowell/cyt_2407.yaml.retry\r\n    \r\n    perf-dione_tomcat-1-tomcat : ok=5    changed=1    unreachable=1    failed=0\r\n    perf-sedna_tomcat-1-tomcat : ok=5    changed=2    unreachable=1    failed=0\r\n    qa-ariel_tomcat-1-tomcat   : ok=5    changed=1    unreachable=1    failed=0\r\n    qa-janus_tomcat-1-tomcat   : ok=0    changed=0    unreachable=1    failed=0\r\n    qa-rhea_tomcat-1-tomcat    : ok=5    changed=1    unreachable=1    failed=0\r\n    \r\n    \r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/255726508","html_url":"https://github.com/ansible/ansible-modules-core/issues/1077#issuecomment-255726508","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/1077","id":255726508,"user":{"login":"Nindaleth","id":6383928,"avatar_url":"https://avatars.githubusercontent.com/u/6383928?v=3","gravatar_id":"","url":"https://api.github.com/users/Nindaleth","html_url":"https://github.com/Nindaleth","followers_url":"https://api.github.com/users/Nindaleth/followers","following_url":"https://api.github.com/users/Nindaleth/following{/other_user}","gists_url":"https://api.github.com/users/Nindaleth/gists{/gist_id}","starred_url":"https://api.github.com/users/Nindaleth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nindaleth/subscriptions","organizations_url":"https://api.github.com/users/Nindaleth/orgs","repos_url":"https://api.github.com/users/Nindaleth/repos","events_url":"https://api.github.com/users/Nindaleth/events{/privacy}","received_events_url":"https://api.github.com/users/Nindaleth/received_events","type":"User","site_admin":false},"created_at":"2016-10-24T12:28:16Z","updated_at":"2016-10-24T12:28:16Z","body":"We ran into similar issue with output registered by this task:\r\n\r\n```\r\n- name: Get rpm -qai\r\n  shell: rpm -qai\r\n  register: rpm_tmp\r\n  no_log: true\r\n  failed_when: \"rpm_tmp.stdout == ''\"\r\n```\r\n\r\nOutput from that contains some equal signs, which will break any further task working with this output. I found following workaround that helped us:\r\n\r\n```\r\n# doesn't work\r\n- name: Store the data somewhere\r\n  lineinfile: line=\"{{ rpm_tmp.stdout }}\" dest=\"/tmp/bugrepro\" insertafter=EOF create=yes\r\n\r\n# does work (just another way of handing over the parameters) - called \"complex args\" in documentation\r\n- name: Store the data somewhere\r\n  lineinfile:\r\n    line: \"{{ rpm_tmp.stdout }}\"\r\n    dest: \"/tmp/workaround\"\r\n    insertafter: EOF\r\n    create: yes\r\n```\r\n\r\nIf you need to do this in local_action, you can too:\r\n\r\n```\r\n- name: Lineinfile\r\n  local_action:\r\n    module: lineinfile\r\n    line: \"{{ rpm_tmp.stdout }}\"\r\n    dest: \"/tmp/workaround\"\r\n    insertafter: EOF\r\n    create: yes\r\n```\r\n\r\nBy the way, I didn't see anywhere in documentation a note on how to use local_action with complex args, figured it out by pure luck. Would be nice to have it written somewhere!"}}
{"actor":{"display_login":"Nindaleth"}}