Stupid Question from a Rookie :)

   - name: create folder
     action: raw mkdir /home/MYPC/${ansible_hostname}

Maybe try using the file module here instead of raw?

   - name: launch uname -a
     action: raw /uname -a > /home/MYPC/${ansible_hostname}/uname.log

Look at using the command module for this action.

If you want the data from the remote host on the host you are running the playbook from, look at the fetch module as
a third task.

Do you know this page?
http://ansible.github.com/modules.html

--Chris

I think I somehow posted and also removed the parent to this message,
so those reading at googlegroups.com may not see it.

The original question is pasted below.

LuC,

Ansible playbooks do things on remote hosts, not the local machine,
mixing commands that you execute remotely with local paths all on the
same line isn't going to make any sense to Ansible.

If you want to log things locally, write or use one of the logger
callbacks... or just use /usr/bin/ansible with the --tree option,
which will approximate what you want.

Though if you just want to see all the unames of all your hosts, an
API script using the setup module may be what you want.

Cc:
Hello,

hope someone can help me.

I have 20 Servers in my network.

hosts file looks like :
[XXX1]
192.168.178.161
192.168.178.162
192.168.178.163

i want to collect informations like "uname -a > uname.log" about these
20 servers and store them on my local pc where im launching ansible.
at the same time i want to create folders on my local pc created by
the ip. So i get 20 directories which have a file called uname.log.

for example my playbooks look like this:
- hosts: XXX1
  user: XXX2
# sudo: False

    - name: create folder
      action: raw mkdir /home/MYPC/${ansible_hostname}

    - name: launch uname -a
      action: raw /uname -a > /home/MYPC/${ansible_hostname}/uname.log

My Problem:

1. ansible try to create folders on the far servers. but i want the
folders local on my pc. then ansible creates folders who called 192

2. i want that ansible store my uname.log also local on my pc

So my Question, what are the Errors, in my Playbook (its just a
chapter :slight_smile: ),
hope some can help me.

Greetz and thanke in advanced

LuC