# problem with shell module and actual command passed

**URL:** <https://forum.ansible.com/t/problem-with-shell-module-and-actual-command-passed/32585>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [April 2, 2020, 7:35am UTC](https://forum.ansible.com/t/problem-with-shell-module-and-actual-command-passed/32585 "2020-04-02T07:35:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolO\_lolO](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@lolO\_lolO](https://forum.ansible.com/u/lolO_lolO)\
**Post date:** [April 2, 2020, 7:35am UTC](https://forum.ansible.com/t/problem-with-shell-module-and-actual-command-passed/32585/1 "2020-04-02T07:35:01Z")

</div>

Hello all !

it’s been a while i have troubles with the shell module:  
as a command is correctly executed in console (even launched as the user awx)

_git push git@savetogit.skylab.local:savetogit/devbackupdesconfigs.git_

but fails through the playbook execution with the output

i’ve already tried a lot of changes (character protection, command line in variable, local script)  
same issue  
the output is

ssh: Could not resolve hostname savetogit.skylab.local: Name or service not know

any idea why such a parsing?

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [April 2, 2020, 8:28am UTC](https://forum.ansible.com/t/problem-with-shell-module-and-actual-command-passed/32585/2 "2020-04-02T08:28:30Z")

</div>

> Hello all !
> 
> it's been a while i have troubles with the shell module:  
> as a command is correctly executed in console (even launched as the user awx)
> 
> /git push git@savetogit.skylab.local:savetogit/devbackupdesconfigs.git/
> 
> but fails through the playbook execution with the output
> 
> i've already tried a lot of changes (character protection, command line in variable, local script)  
> same issue  
> the output is  
> ssh: Could not resolve hostname savetogit.skylab.local: Name or service not know
> 
> any idea why such a parsing?

How does your playbook / task look like? In the Git URL above you have savetogit.skylab.local,  
but below you say you want to push to skylab.local.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![lolO\_lolO](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@lolO\_lolO](https://forum.ansible.com/u/lolO_lolO)\
**Post date:** [April 2, 2020, 10:08am UTC](https://forum.ansible.com/t/problem-with-shell-module-and-actual-command-passed/32585/3 "2020-04-02T10:08:16Z")

</div>

Hello Racke,

here 's my git tasks:

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [April 2, 2020, 10:20am UTC](https://forum.ansible.com/t/problem-with-shell-module-and-actual-command-passed/32585/4 "2020-04-02T10:20:29Z")

</div>

> Hello Racke,
> 
> # here 's my git tasks:
> 
> tasks:  
> - name: git local actions  
> shell: |  
> git config --global user.name "savetogit@babel.local"  
> git add -A  
> git commit -m "Ajout des nouveaux fichiers au repo"  
> exit 0
> 
> ```
> args:
> chdir: &quot;\{\{ workingdir \}\}&quot;
> 
> \- name: git push to remote
> shell: &quot;git push git@savetogit\.skylab\.local:savetogit/devbackupdesconfigs\.git&quot;
> 
> args:
> chdir: &quot;\{\{ workingdir \}\}&quot;
> 
>  
> register: gitcommand\_return
> changed\_when: gitcommand\_return\.stdout is not search\(&#39;nothing to commit&#39;\)
> failed\_when: &quot;&#39;FAILED&#39; in gitcommand\_return\.stderr&quot;
> 
> ```
> 
> ====
> 
> my gitlab server is skylab.local  
> the syntax \*git push git@savetogit.skylab.local:savetogit/devbackupdesconfigs.git \*allows to push with another ssh user  
> credential (user = savetogit)  
> it works fine in console

I think the correct push command for the remote user savetogit would be:

git push savetogit@skylab.local:savetogit/devbackupdesconfigs.git

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![lolO\_lolO](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@lolO\_lolO](https://forum.ansible.com/u/lolO_lolO)\
**Post date:** [April 2, 2020, 12:05pm UTC](https://forum.ansible.com/t/problem-with-shell-module-and-actual-command-passed/32585/5 "2020-04-02T12:05:26Z")

</div>

in console :

-bash-4.2$ whoami  
awx  
-bash-4.2$ git push git@savetogit.skylab.local:savetogit/devbackupdesconfigs.git  
Counting objects: 9, done.  
Delta compression using up to 2 threads.  
Compressing objects: 100% (4/4), done.  
Writing objects: 100% (5/5), 503 bytes | 0 bytes/s, done.  
Total 5 (delta 1), reused 0 (delta 0)  
To git@savetogit.skylab.local:savetogit/devbackupdesconfigs.git

bcbe3ed…2cfbb27 master → master

-bash-4.2$ git push savetogit@skylab.local:savetogit/devbackupdesconfigs.git  
savetogit@skylab.local’s password:

this second command doesn’t work with ssh keys and asks password
