Since your script doesn't specify an absolute path for the output, I
suspect it's writing it to the Ansible module tempdir, which is being
promptly deleted as soon as the task finished. Try adding a
chdir=/some/permanent/path to the end of the command task to run the script
from a non-ephemeral location.
On Thursday, September 15, 2016 at 12:30:28 PM UTC-7, richard kappler wrote:
>
> I have a bash script ( I know, it's a bit sloppy):
>
> #!/bin/sh
>
> df -h >> mongo-rebuild-validate.log 2>&1
>
> /opt/mongodb/bin/mongo localhost:27017
> /opt/mongodb/mongodb-create-visionnode.js >> mongo-rebuild-validate.log 2>&1
>
> /opt/mongodb/bin/mongoimport --host 127.0.0.1 --db visionnode --collection
> ftpUser --file /opt/mongodb/ftpUserJSON-Linux.js >>
> mongo-rebuild-validate.log 2>&1
>
> df -h >> mongo-rebuild-validate.log 2>&1
>
> on remotes servers that works fine, does what I designed it to do,
> including writing all the stdout and stderr to the intended log.
>
> However, when try to run this script remotely using:
>
> ---
> - name: Rebuild the mongo db
> hosts: servers
> gather_facts: false
> tasks:
>
> - name: execute rebuild-SSPC-db.sh
> command: /opt/mongodb/rebuild-SSPC-db.sh
>
> - name: bring back validation file
> fetch: src=/opt/mongodb/mongo-rebuild-validate.log
> dest=/playbooks/MongoRebuild/validations/prefix-{{ inventory_hostname }}
> flat=yes
>
> it rebuilds the database and creates the ftpUser, but it does not write
> anything to the validation log.
>
> What am I missing?
>
--
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/af131135-dab3-407e-b3eb-0159e76e2704%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.