Using "shell" with a switch

123 views
Skip to first unread message

Dimitri Yioulos

unread,
Dec 3, 2018, 11:44:08 AM12/3/18
to Ansible Project
Hey, all.

I need to run a script residing on the remote machine with a switch, as in "/scripts/myscript -f" (it must be executed by root).  I'm using the shell module, but can find no way to add the switch without the play failing.  Help would be appreciated.

Dimitri

Piotr Owcarz

unread,
Dec 3, 2018, 4:25:41 PM12/3/18
to ansible...@googlegroups.com
Hey Dimitri,

Why don't you send us your code and the output you are receiving?

Piotr




--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/06746b76-6bd3-419d-a2d8-6e96d8667844%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dimitri Yioulos

unread,
Dec 3, 2018, 5:22:04 PM12/3/18
to Ansible Project
OK:

---
- hosts: all
  gather_facts: false
  become: yes
#  become_user: root
#  become_method: su
  tasks:
    - shell: "su - root"
      args:
        warn: false
    - shell: '/scripts/dnscopy.pl -f'
      register: (result)
    - debug:
        var: (result)
        verbosity: 2

*become_user and become_method are commented out in favor of shell: "su - root" because using the former causes a timeout error, But that's another issue.

Output of play:

TASK [command] ***************************************************************************************************************************************************************************
fatal: [admin1]: FAILED! => {"changed": true, "cmd": "/scripts/dnscopy.pl -f", "delta": "0:00:01.425695", "end": "2018-12-03 17:13:56.113927", "failed": true, "rc": 2, "start": "2018-12-03 17:13:54.688232", "stderr": "Can't exec \"rndc\": No such file or directory at /scripts/dnscopy.pl line 296.\nrndc -s dns1 reload failed: No such file or directory at /scripts/dnscopy.pl line 296.", "stderr_lines": ["Can't exec \"rndc\": No such file or directory at /scripts/dnscopy.pl line 296.", "rndc -s dns1 reload failed: No such file or directory at /scripts/dnscopy.pl line 296."], "stdout": "", "stdout_lines": []}

without the -f switch, the play completes successfully.

Piotr Owcarz

unread,
Dec 3, 2018, 6:37:38 PM12/3/18
to ansible...@googlegroups.com
Dimitri,

    - shell: "su - root"
      args:
        warn: false
    - shell: '/scripts/dnscopy.pl -f'
      register: (result)

You are running 2 separate shells. First shell runs su - root then exits - this is not doining anything. Then secon task runs in a new shell, you are not leveraging the previous "su - root". You are using become: yes, and that should be sufficient to elevate task's rights, so the second task should work anyway. Try this:
Remove     
- shell: "su - root" task
replace it with:   
 - shell: "whoami"
   register: who
 - debug: var=who 
 to check under which user is your script executing. If it's not 'root' then you messed up, if it is 'root' but your script still fails, you have a problem with your script.

Piotr


--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Dimitri Yioulos

unread,
Dec 4, 2018, 8:34:43 AM12/4/18
to Ansible Project
Thank you, Piotr.  All good, now.  You're right, and this is a mistake I shouldn't have made, given my long history with Ansible.  But, hey, never too late to learn.  Thanks, again.


On Monday, December 3, 2018 at 11:44:08 AM UTC-5, Dimitri Yioulos wrote:

Dimitri Yioulos

unread,
Dec 4, 2018, 9:38:03 AM12/4/18
to Ansible Project
Piotr,

Before I consider this solved, let me push the envelope a bit, and ask about the switch.  If I run the play like this:

Shell: /scripts/myscript

it works.

If I run it like this:

Shell: /scripts/myscript -f

it fails with:

fatal: [admin1]: FAILED! => {"changed": true, "cmd": "/scripts/dnscopy.pl -f", "delta": "0:00:02.025735", "end": "2018-12-04 09:34:11.123312", "failed": true, "rc": 2, "start": "2018-12-04 09:34:09.097577", "stderr": "Can't exec \"rndc\": No such file or directory at /scripts/dnscopy.pl line 296.\nrndc -s dns1 reload failed: No such file or directory at /scripts/dnscopy.pl line 296.", "stderr_lines": ["Can't exec \"rndc\": No such file or directory at /scripts/dnscopy.pl line 296.", "rndc -s dns1 reload failed: No such file or directory at /scripts/dnscopy.pl line 296."], "stdout": "", "stdout_lines": []}

Your continued help (or anybody else's) would be appreciated.

Dimitri


On Monday, December 3, 2018 at 11:44:08 AM UTC-5, Dimitri Yioulos wrote:

Kai Stian Olstad

unread,
Dec 4, 2018, 9:56:28 AM12/4/18
to ansible...@googlegroups.com
On Tuesday, 4 December 2018 15:38:03 CET Dimitri Yioulos wrote:
> Before I consider this solved, let me push the envelope a bit, and ask
> about the switch. If I run the play like this:
>
> Shell: /scripts/myscript
>
> it works.
>
> If I run it like this:
>
> Shell: /scripts/myscript -f
>
> it fails with:
>
> fatal: [admin1]: FAILED! => {"changed": true, "cmd": "/scripts/dnscopy.pl
> -f", "delta": "0:00:02.025735", "end": "2018-12-04 09:34:11.123312",
> "failed": true, "rc": 2, "start": "2018-12-04 09:34:09.097577", "stderr":
> "Can't exec \"rndc\": No such file or directory at /scripts/dnscopy.pl line
> 296.\nrndc -s dns1 reload failed: No such file or directory at
> /scripts/dnscopy.pl line 296.", "stderr_lines": ["Can't exec \"rndc\": No
> such file or directory at /scripts/dnscopy.pl line 296.", "rndc -s dns1
> reload failed: No such file or directory at /scripts/dnscopy.pl line
> 296."], "stdout": "", "stdout_lines": []}
>
> Your continued help (or anybody else's) would be appreciated.

You script does something else with -f than without.
As the error message say it can't find rndc, so I guess it's a missing path issue.

--
Kai Stian Olstad


Dimitri Yioulos

unread,
Dec 4, 2018, 10:10:48 AM12/4/18
to Ansible Project
Thanks, Kai.

Now, I'm completely turned around.

In order for /scripts/dnscopy.pl -f to work in the remote host itself, I must su - root first.  I thought that become: yes took care of that.  Here's the playbook as it stands (and fails) now:

---

- hosts: all
  gather_facts: false
  become: yes

  tasks:
    - shell: /scripts/dnscopy.pl -f
      register: script_output
    - debug:
        var: script_output.stdout_lines

Continued help very much apprecuated.

On Monday, December 3, 2018 at 11:44:08 AM UTC-5, Dimitri Yioulos wrote:

Kai Stian Olstad

unread,
Dec 4, 2018, 10:25:08 AM12/4/18
to ansible...@googlegroups.com
On Tuesday, 4 December 2018 16:10:48 CET Dimitri Yioulos wrote:
> Thanks, Kai.
>
> Now, I'm completely turned around.
>
> In order for /scripts/dnscopy.pl -f to work in the remote host itself, I
> must su - root first. I thought that become: yes took care of that.
> Here's the playbook as it stands (and fails) now:

Become uses sudo by default unless you set become_method: su

Default I think it only will do "su root -c /scripts/dnscopy.pl -f" so if you need the - aka --login option you might need become_flags: '-' as well


--
Kai Stian Olstad


Dimitri Yioulos

unread,
Dec 4, 2018, 10:35:09 AM12/4/18
to Ansible Project
Sorry, Kai, I'm not understanding what the playbook should look like.  I'm a bit slow on the uptake.


On Monday, December 3, 2018 at 11:44:08 AM UTC-5, Dimitri Yioulos wrote:

Kai Stian Olstad

unread,
Dec 4, 2018, 10:37:58 AM12/4/18
to ansible...@googlegroups.com
On Tuesday, 4 December 2018 16:35:09 CET Dimitri Yioulos wrote:
> Sorry, Kai, I'm not understanding what the playbook should look like. I'm
> a bit slow on the uptake.

- hosts: all
gather_facts: false
become: yes
become_method: su
become_flags: '-'

tasks:
- shell: /scripts/dnscopy.pl -f
register: script_output
- debug:
var: script_output.stdout_lines

--
Kai Stian Olstad


Dimitri Yioulos

unread,
Dec 4, 2018, 11:10:38 AM12/4/18
to Ansible Project
I thought that's what I should do.  I made those changes, but then the playbook is stuck/runs without completion (until it ultimately times out, I'm guessing).

On Monday, December 3, 2018 at 11:44:08 AM UTC-5, Dimitri Yioulos wrote:

Piotr Owcarz

unread,
Dec 4, 2018, 12:52:19 PM12/4/18
to ansible...@googlegroups.com
Dimitri,
Send us the output of the following (with become etc)

 - shell: "whoami"
   register: who
 - debug: var=who 

Also: login to remote machine, switch to root and run your script with -f switch. What output are you getting? What do you get when you run "which rndc" as root?

Piotr

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Dimitri Yioulos

unread,
Dec 4, 2018, 1:49:53 PM12/4/18
to Ansible Project
Piotr,

After putting in the directives you mentioned, if I leave become_method: su and become_flags: '-' in the playbook, then the playbook is stuck/runs without completion.  If I take those out, leaving only become: yes, then I get the following output:

ok: [admin1] => {
    "who": {
        "changed": true, 
        "cmd": "whoami", 
        "delta": "0:00:00.006895", 
        "end": "2018-12-04 13:32:06.805245", 
        "rc": 0, 
        "start": "2018-12-04 13:32:06.798350", 
        "stderr": "", 
        "stderr_lines": [], 
        "stdout": "root", 
        "stdout_lines": [
            "root"
        ]
    }
}

If I run the script on the remote host without su - root, I get:

Can't exec "rndc": No such file or directory at ./dnscopy.pl line 296.
rndc -s dns1 reload failed: No such file or directory at ./dnscopy.pl line 296.

If I run the script on the remote host with su - root, I get:

server reload successful


On Monday, December 3, 2018 at 11:44:08 AM UTC-5, Dimitri Yioulos wrote:

Piotr Owcarz

unread,
Dec 4, 2018, 2:28:17 PM12/4/18
to ansible...@googlegroups.com
Dimitri

The only resonable explanation is, that you have something with the PATH env variable (btw what is the remote OS?). Try this:
1. Login to remote machine and switch to root. Send me an output of 'echo $PATH' and 'which rndc'
2. run the same playbook with tasks:
 - shell: "'echo $PATH'"
   register: path
 - debug: var=path 

If it's possible, send me the dnscopy.pl script

Piotr

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Dimitri Yioulos

unread,
Dec 4, 2018, 3:07:10 PM12/4/18
to Ansible Project
Piotr,

The thing of it is, the script (which I didn't write) runs the rndc (BIND Remote Name Daemon Control - we use it to reload zone files) command on our dns servers (which it locates), not on the host in which the script is located. Thus, the failure. Here's a snippet from the script:

    # rndc -s dns1 reload
    @args = ("rndc", "-s", "dns1", "reload");
    system(@args) == 0
        or die "rndc -s dns1 reload failed: $!";

Changes to the script are not an option.

That said, is what I'm trying to do not doable?

Dimitri


On Monday, December 3, 2018 at 11:44:08 AM UTC-5, Dimitri Yioulos wrote:

Piotr Owcarz

unread,
Dec 4, 2018, 3:31:06 PM12/4/18
to ansible...@googlegroups.com
Dimitri
Your script is depending on rndc residing in the host's $PATH. It might happen, that the root's profile is being set differently when you become root in Ansible playbook, than the situation when are switching to root in a regular way in SSH or terminal. This is why I asked you for more information in my previous post.
A possible workaround would be to forcibly set PATH env variable when calling dnscopy.pl. but I can't give you a ready recipe because I don't have enough informaton about your system

Piotr



--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Dimitri Yioulos

unread,
Dec 4, 2018, 3:48:17 PM12/4/18
to Ansible Project
Piotr,

Fair enough.  And, I do appreciate you sticking with this.

Output of "echo $PATH":

/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin

Output of "which rndc":

/usr/bin/which: no rndc in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin)   <-- not a surprise; BIND isn't installed on this machine

Output after adding - shell: "'echo $PATH'", etc. to playbook:

ok: [admin1] => {
    "path": {
        "changed": true, 
        "cmd": "echo $PATH", 
        "delta": "0:00:00.006128", 
        "end": "2018-12-04 14:36:50.766764", 
        "rc": 0, 
        "start": "2018-12-04 14:36:50.760636", 
        "stderr": "", 
        "stderr_lines": [], 
        "stdout": "/usr/bin:/bin", 
        "stdout_lines": [
            "/usr/bin:/bin"
        ]
    }
}

Remote machine OS os CentOS 5.11     <-- yes, I know


On Monday, December 3, 2018 at 11:44:08 AM UTC-5, Dimitri Yioulos wrote:

Piotr Owcarz

unread,
Dec 4, 2018, 4:21:45 PM12/4/18
to ansible...@googlegroups.com
Hi

/usr/bin/which: no rndc in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin)   <-- not a surprise; BIND isn't installed on this machine

So, do you already know what the problem is? Are you executing rndc on remote host but you dont have BIND installed on it?

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

sateesh s

unread,
Dec 4, 2018, 4:24:43 PM12/4/18
to ansible...@googlegroups.com
Hi,

I am trying to setup communication between ansible and a windows server which is hosted in virtual machine manager. Do any one know about it.

I am getting error like 
Bad HTTP response from server . Code 404

Thanks in advance

Kai Stian Olstad

unread,
Dec 4, 2018, 4:32:50 PM12/4/18
to ansible...@googlegroups.com
On Tuesday, 4 December 2018 22:24:21 CET sateesh s wrote:
> I am trying to setup communication between ansible and a windows server
> which is hosted in virtual machine manager. Do any one know about it.
>
> I am getting error like
> Bad HTTP response from server . Code 404
>
> Thanks in advance

Can you stop hijacking thread that has nothing to do with your problem.


--
Kai Stian Olstad


Kai Stian Olstad

unread,
Dec 4, 2018, 4:44:55 PM12/4/18
to ansible...@googlegroups.com
On Tuesday, 4 December 2018 21:48:17 CET Dimitri Yioulos wrote:
> Piotr,
>
> Fair enough. And, I do appreciate you sticking with this.
>
> Output of "echo $PATH":
>
> /usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin
>
> Output of "which rndc":
>
> /usr/bin/which: no rndc in
> (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin) <-- not a surprise;
> BIND isn't installed on this machine

rndc is usually located in /usr/sbin so you can't use which to determine if it's installed since /usr/sbin in some distribution is only in root's path.


The problem in this long thread you have not showed the complete command you are running, neither with Ansible or manually on the command line with the result.


With ansible-playbook it's preferably to have that with -vvvv and to make the output easier to read the debug callback plugin.
Then the command will be
ANSIBLE_STDOUT_CALLBACK=debug ansible-playbook .........
Because of the missing output these thread have a tendency to be longer than they could have been.

su usually require a root password so do you use -K/--ask-become-pass on the command line.

--
Kai Stian Olstad


Dimitri Yioulos

unread,
Dec 4, 2018, 4:52:30 PM12/4/18
to Ansible Project
Piotr,

Well, not quite.  It's true that Bind isn't installed on the host in which the script is installed and runs.  If I run the script from there, after su'ing to root, it works fine. But, why doesn't the script execute from Ansible as written - running rndc on the dns servers that are identified in the script?

Dimitri


On Monday, December 3, 2018 at 11:44:08 AM UTC-5, Dimitri Yioulos wrote:

Piotr Owcarz

unread,
Dec 4, 2018, 5:14:23 PM12/4/18
to ansible...@googlegroups.com
Kai,

What are you trying to say? Are there limits to thread lenght in this group? 
I recenty posted a question in another thread and noticed, that this mail group is seriously lacking involvment, which I totally get - people asking trivial questions don't deserve expert's answers, I totally get it. More experienced people have better things to do than answering dumb questions, and here I am, with an intermediate experience in Ansible. I thought, since Ansible is helping me, why don't I help Ansible in answering trivial questions? I am spending this week at a hotel, days are short, not much to do, why don't I educate myself and help the others? Let me know if I am doing anything wrong and I will stop it. 
 
Piotr

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Karl Auer

unread,
Dec 4, 2018, 5:26:25 PM12/4/18
to ansible-project
Hullo Piotr.

No, it's just that people very often do not post their entire playbook or the complete output from their runs. This it often misleads responders, who go down various dead ends before finally requesting that the OP post *everything*, then at last the problem gets resolved. In a long thread, this often happens more than once, as different people take and interest and get involved.

There's no problem with long threads, I think Kai was just making the point that with too little info from the OP, resolutions can take longer... When some one provides only edited versions of their playbook or its output, they are making assumptions about the location and cause of the problem that may be unwarranted. It's very understandable - Ansible output is quite verbose - but still mostly a bad idea.

Like you, I will often "have a go" at a question that is within my grasp, but if a question is not one I can answer I stay silent.

Regards, K.


For more options, visit https://groups.google.com/d/optout.


--
Karl Auer

Email  : ka...@2pisoftware.com
Website: http://2pisoftware.com


GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

Piotr Owcarz

unread,
Dec 4, 2018, 5:55:20 PM12/4/18
to ansible...@googlegroups.com
Karl,
Yeah, I have already noticed that some people act like they learned internet forums yesterday. I feel totally noob now, but what do you do if the question is within within your grasp, but you lack a little information? 

Piotr




Dimitri Yioulos

unread,
Dec 5, 2018, 10:02:04 AM12/5/18
to Ansible Project
My sincere apologies for creating such a long thread - never my intention.  I've received a lot of great help from this list, and don't want to jeopardize that.  As I mentioned earlier, I'm not always quick on the uptake. Thank you for sticking with me.  And, all of your effort have paid off, as I've come to the solution!  This is what my playbook looks like now:

---

- hosts: all
  gather_facts: false
  become: yes
  become_method: su
  become_flags: '-'
  vars:
    ansible_become_pass: "rootpass"

  tasks:
    - shell: /scripts/dnscopy.pl -f
      register: script_output
    - debug:
        var: script_output.stdout_lines

It returns the same output as if I ran the script on the remote host:

TASK [command] ****************************************************************
task path: /etc/ansible/playbooks/rundeck/dnscopy.yml:13
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
<admin1> ESTABLISH SSH CONNECTION FOR USER: a-scripting
<admin1> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=a-scripting -o ConnectTimeout=300 -o ControlPath=/root/.ansible/cp/00d0d0be4b admin1 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<admin1> (0, '/home/a-scripting\n', '')
<admin1> ESTABLISH SSH CONNECTION FOR USER: a-scripting
<admin1> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=a-scripting -o ConnectTimeout=300 -o ControlPath=/root/.ansible/cp/00d0d0be4b admin1 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/a-scripting/.ansible/tmp/ansible-tmp-1544020870.43-70326662458073 `" && echo ansible-tmp-1544020870.43-70326662458073="` echo /home/a-scripting/.ansible/tmp/ansible-tmp-1544020870.43-70326662458073 `" ) && sleep 0'"'"''
<admin1> (0, 'ansible-tmp-1544020870.43-70326662458073=/home/a-scripting/.ansible/tmp/ansible-tmp-1544020870.43-70326662458073\n', '')
<admin1> PUT /tmp/tmpKrQPZW TO /home/a-scripting/.ansible/tmp/ansible-tmp-1544020870.43-70326662458073/command.py
<admin1> SSH: EXEC sshpass -d12 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=a-scripting -o ConnectTimeout=300 -o ControlPath=/root/.ansible/cp/00d0d0be4b '[admin1]'
<admin1> (0, 'sftp> put /tmp/tmpKrQPZW /home/a-scripting/.ansible/tmp/ansible-tmp-1544020870.43-70326662458073/command.py\n', '')
<admin1> ESTABLISH SSH CONNECTION FOR USER: a-scripting
<admin1> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=a-scripting -o ConnectTimeout=300 -o ControlPath=/root/.ansible/cp/00d0d0be4b admin1 '/bin/sh -c '"'"'chmod u+x /home/a-scripting/.ansible/tmp/ansible-tmp-1544020870.43-70326662458073/ /home/a-scripting/.ansible/tmp/ansible-tmp-1544020870.43-70326662458073/command.py && sleep 0'"'"''
<admin1> (0, '', '')
<admin1> ESTABLISH SSH CONNECTION FOR USER: a-scripting
<admin1> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o User=a-scripting -o ConnectTimeout=300 -o ControlPath=/root/.ansible/cp/00d0d0be4b -tt admin1 '/bin/sh -c '"'"'su - root -c '"'"'"'"'"'"'"'"'/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-ekoalvjsxgctatfhsngmjohojiatrsbx; /usr/bin/python /home/a-scripting/.ansible/tmp/ansible-tmp-1544020870.43-70326662458073/command.py; rm -rf "/home/a-scripting/.ansible/tmp/ansible-tmp-1544020870.43-70326662458073/" > /dev/null 2>&1'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"''"'"'"'"'"'"'"'"' && sleep 0'"'"''
<admin1> (0, '\r\n\r\n{"changed": true, "end": "2018-12-05 09:41:14.641125", "stdout": "server reload successful\\nserver reload successful\\nserver reload successful\\nserver reload successful", "cmd": "/scripts/dnscopy.pl -f", "rc": 0, "start": "2018-12-05 09:41:10.058261", "stderr": "", "delta": "0:00:04.582864", "invocation": {"module_args": {"warn": true, "executable": null, "_uses_shell": true, "_raw_params": "/scripts/dnscopy.pl -f", "removes": null, "creates": null, "chdir": null}}, "warnings": []}\r\n', 'Shared connection to admin1 closed.\r\n')
changed: [admin1] => {

    "changed": true, 
    "cmd": "/scripts/dnscopy.pl -f", 
    "delta": "0:00:04.582864", 
    "end": "2018-12-05 09:41:14.641125", 
    "invocation": {
        "module_args": {
            "_raw_params": "/scripts/dnscopy.pl -f", 
            "_uses_shell": true, 
            "chdir": null, 
            "creates": null, 
            "executable": null, 
            "removes": null, 
            "warn": true
        }
    }, 
    "rc": 0, 
    "start": "2018-12-05 09:41:10.058261"
}
STDOUT:
server reload successful
server reload successful
server reload successful
server reload successful


TASK [debug] ****************************************************************
task path: /etc/ansible/playbooks/rundeck/dnscopy.yml:15
ok: [admin1] => {
    "script_output.stdout_lines": [
        "server reload successful", 
        "server reload successful", 
        "server reload successful", 
        "server reload successful"

    ]
}

I'm very grateful to Piotr and Kai for their kind and expert assistance!!!  Thank you so much.

Kai Stian Olstad

unread,
Dec 5, 2018, 10:32:44 AM12/5/18
to ansible...@googlegroups.com
On Tuesday, 4 December 2018 23:14:02 CET Piotr Owcarz wrote:
> Kai,
>
> What are you trying to say?

I could just say, what Karl said because that was well written, but I add some answers since your post is addressed to me.


> Are there limits to thread lenght in this group?

There is no limit, and my answer was not meant as any criticism of you since my relay was to the OP.
For what it's worth, I think you have done a great job in the thread.


> I recenty posted a question in another thread and noticed, that this mail
> group is seriously lacking involvment, which I totally get - people asking
> trivial questions don't deserve expert's answers, I totally get it. More
> experienced people have better things to do than answering dumb questions,
> and here I am, with an intermediate experience in Ansible.

Your first post was in a relative old thread, you should have created your own.
Old thread might not get all that attention and when people see that it is a reply to a thread the think it's an answer and not actually a question as it was in your first post to the list.

I did read the post but did not understand the problem since you had not provided enough information.
In fear of being caught in a long thread(waste of time) like you did here, because OP did not give enough information I just click on the next unread message to see if it was a lot easier to help that person instead.


> I thought, since
> Ansible is helping me, why don't I help Ansible in answering trivial
> questions?

As I already have mention, my post was addressed to OP not you.
That you are willing to help is a huge plus.


> I am spending this week at a hotel, days are short, not much to
> do, why don't I educate myself and help the others? Let me know if I am
> doing anything wrong and I will stop it.

You did nothing wrong at all, I truly hope you keep contribute to the list.


--
Kai Stian Olstad


Kai Stian Olstad

unread,
Dec 5, 2018, 10:41:14 AM12/5/18
to ansible...@googlegroups.com
On Tuesday, 4 December 2018 23:54:56 CET Piotr Owcarz wrote:
> Yeah, I have already noticed that some people act like they learned
> internet forums yesterday. I feel totally noob now, but what do you do if
> the question is within within your grasp, but you lack a little
> information?

I do recommend you ask.

I did that in the beginning, but now I have mostly stopped doing that since it do take up a lot of time.


--
Kai Stian Olstad


Kai Stian Olstad

unread,
Dec 5, 2018, 10:57:12 AM12/5/18
to ansible...@googlegroups.com
On Wednesday, 5 December 2018 16:02:03 CET Dimitri Yioulos wrote:
> My sincere apologies for creating such a long thread - never my intention.
> I've received a lot of great help from this list, and don't want to
> jeopardize that.

No worry, you haven't.
My mail was about you to provide more information, I could have left out the "long thread" in my reply, but I didn't since you/we where back to the stating point.


> As I mentioned earlier, I'm not always quick on the
> uptake. Thank you for sticking with me. And, all of your effort have paid
> off, as I've come to the solution! This is what my playbook looks like now:
>
> ---
> > - hosts: all
> > gather_facts: false
> > become: yes
> > become_method: su
> > become_flags: '-'
> > vars:
> > ansible_become_pass: "rootpass"
> > tasks:
> > - shell: /scripts/dnscopy.pl -f
> > register: script_output
> > - debug:
> > var: script_output.stdout_lines

So it was just about missing password.
(The fun thing is that if you had provided complete output, as you did in this post, in your first post I guessing you had gotten an answer the same day.
But no harm done, since you have a working solution.)
> > *server reload successfulserver reload successfulserver reload
> > successfulserver reload successful*
> >
> > TASK [debug]
> > ****************************************************************
> > task path: /etc/ansible/playbooks/rundeck/dnscopy.yml:15
> > ok: [admin1] => {
> > "script_output.stdout_lines": [
> >
> >
> >
> > * "server reload successful", "server reload successful",
> > "server reload successful", "server reload successful"*
> > ]
> > }

This output is a huge help for us to help you when you have problem.
Keep that in mind next time you have a problem you need help with.

-vvvv is not need all the time, but are you unsure it's better to include it that not.


--
Kai Stian Olstad


Reply all
Reply to author
Forward
0 new messages