Ansible 1.6
Host machine: Ubuntu 14.04 LTS, kernel: 3.13.0-24-generic.
paco@paco-K53SD:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
Server machine: Raspbian
pi@raspberrypi /etc/owncloud $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.5 (wheezy)
Release: 7.5
Codename: wheezy
I have no special settings in sudo:
sudo cat /etc/sudoers
Defaults env_reset
Defaults mail_badpass
Defaults secure_path=
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
#includedir /etc/sudoers.d
pi ALL=(ALL) NOPASSWD: ALL
site.yml:
user: pi
sudo: true
roles:
- gitlab
roles/gitlab/tasks/main.yml
- name: initialize db
shell: yes | bundle exec rake gitlab:setup RAILS_ENV=production chdir=
/home/gitlab/hd/gitlab
El martes, 15 de julio de 2014 17:38:41 UTC+2, Michael DeHaan escribió:
>
> Right, you're not going to get that particular error because of shell vs
> command. Though you should use shell for the shell operations.
>
> What versions of Ansible are you running, what OSes are you connecting
> from and to?
>
> Anything particularly interesting about the sudoers configuration?
>
>
> On Tue, Jul 15, 2014 at 10:06 AM, Paco p <[email protected] <javascript:>>
> wrote:
>
>> I continued following the same issue:
>>
>> <192.168.1.104> ESTABLISH CONNECTION FOR USER: pi
>> <192.168.1.104> REMOTE_MODULE command yes | bundle exec rake gitlab:setup
>> RAILS_ENV=production chdir=/home/gitlab/hd/gitlab #USE_SHELL
>> <192.168.1.104> EXEC ['ssh', '-C', '-tt', '-vvv', '-o',
>> 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o',
>> 'ControlPath=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22',
>> '-o', 'KbdInteractiveAuthentication=no', '-o',
>> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey',
>> '-o', 'PasswordAuthentication=no', '-o', 'User=pi', '-o',
>> 'ConnectTimeout=10', '192.168.1.104', "/bin/sh -c 'mkdir -p
>> $HOME/.ansible/tmp/ansible-tmp-1405431909.52-211323817066995 && chmod a+rx
>> $HOME/.ansible/tmp/ansible-tmp-1405431909.52-211323817066995 && echo
>> $HOME/.ansible/tmp/ansible-tmp-1405431909.52-211323817066995'"]
>> <192.168.1.104> PUT /tmp/tmpXQj46R TO
>> /home/pi/.ansible/tmp/ansible-tmp-1405431909.52-211323817066995/command
>> <192.168.1.104> EXEC ['ssh', '-C', '-tt', '-vvv', '-o',
>> 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o',
>> 'ControlPath=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22',
>> '-o', 'KbdInteractiveAuthentication=no', '-o',
>> 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey',
>> '-o', 'PasswordAuthentication=no', '-o', 'User=pi', '-o',
>> 'ConnectTimeout=10', '192.168.1.104', u'/bin/sh -c \'sudo -k && sudo -H -S
>> -p "[sudo via ansible, key=lvabfvouobbyzqqcpklpxtvljduerijf] password: " -u
>> root /bin/sh -c \'"\'"\'echo SUDO-SUCCESS-lvabfvouobbyzqqcpklpxtvljduerijf;
>> LC_CTYPE=C LANG=C /usr/bin/python
>> /home/pi/.ansible/tmp/ansible-tmp-1405431909.52-211323817066995/command; rm
>> -rf /home/pi/.ansible/tmp/ansible-tmp-1405431909.52-211323817066995/
>> >/dev/null 2>&1\'"\'"\'\'']
>>
>> failed: [192.168.1.104] => {"failed": true, "item": "", "parsed": false}
>> invalid output was: SUDO-SUCCESS-lvabfvouobbyzqqcpklpxtvljduerijf
>> Killed
>> OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
>> debug1: Reading configuration data /home/user/.ssh/config
>> debug1: /home/user/.ssh/config line 19: Applying options for 192.168.1.104
>> debug1: Reading configuration data /etc/ssh/ssh_config
>> debug1: /etc/ssh/ssh_config line 19: Applying options for *
>> debug1: auto-mux: Trying existing master
>> debug2: fd 3 setting O_NONBLOCK
>> debug2: mux_client_hello_exchange: master version 4
>> debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
>> debug3: mux_client_request_session: entering
>> debug3: mux_client_request_alive: entering
>> debug3: mux_client_request_alive: done pid = 4217
>> debug3: mux_client_request_session: session request sent
>> debug1: mux_client_request_session: master session id: 2
>> debug3: mux_client_read_packet: read header failed: Broken pipe
>> debug2: Received exit status from master 0
>> Shared connection to 192.168.1.104 closed.
>>
>>
>> FATAL: all hosts have already failed -- aborting
>>
>>
>> El lunes, 14 de julio de 2014 21:08:28 UTC+2, James Cammarata escribió:
>>>
>>> You'll need to use the "shell:" version of the module for the piping of
>>> commands:
>>>
>>> - name: execute script
>>> shell: "yes | bash /tmp/a.sh"
>>>
>>>
>>>
>>> On Mon, Jul 14, 2014 at 9:05 AM, Paco p <[email protected]> wrote:
>>>
>>>> Hello, I need interact with a script, so I have a script as(/tmp/a.sh):
>>>>
>>>>
>>>> read var
>>>>
>>>> if [[ $var == "y" ]];
>>>> then
>>>> exit 0;
>>>> else
>>>> exit 1;
>>>> fi
>>>>
>>>>
>>>>
>>>>
>>>> And in my playbook
>>>>
>>>> - name: execute script
>>>> command: "yes | bash /tmp/a.sh"
>>>>
>>>>
>>>>
>>>>
>>>> And I am getting the following:
>>>> failed: [192.168.1.104] => {"failed": true, "item": "", "parsed": false
>>>> }
>>>> invalid output was: SUDO-SUCCESS-pmmitceeyaxmudspoxnoywwlhxsrkopg
>>>> Killed
>>>>
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Ansible Project" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>>
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/ansible-project/1da79ca0-c2f6-4359-b657-
>>>> 49757189e76c%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/ansible-project/1da79ca0-c2f6-4359-b657-49757189e76c%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/ca1421e3-b7e7-47ce-bd2f-b14a7118d3cc%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/ca1421e3-b7e7-47ce-bd2f-b14a7118d3cc%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/e3df19cc-fda3-4f43-8196-9768f95acb1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.