Return values of Ansible Commands

0 votes
I've recently started learning Ansible and I wanted to know the return values of the Ansible Commands. How do I get those?
Apr 2 in Ansible by Rani
45 views

1 answer to this question.

0 votes

Hey @Rani, you could try something like this:

ansible 12.34.56.78  -m stat -a "path=/appserver"
12.34.56.78 | success >> {
"changed": false,
"stat": {
    "atime": 1424197918.2113113,
    "ctime": 1423779491.431509,
    "dev": 64768,
    "exists": true,
    "gid": 1000,
    "inode": 9742,
    "isblk": false,
    "ischr": false,
    "isdir": true,
    "isfifo": false,
    "isgid": false,
    "islnk": false,
    "isreg": false,
    "issock": false,
    "isuid": false,
    "mode": "0755",
    "mtime": 1423585087.2470782,
    "nlink": 4,
    "pw_name": "cloud",
    "rgrp": true,
    "roth": true,
    "rusr": true,
    "size": 4096,
    "uid": 1000,
    "wgrp": false,
    "woth": false,
    "wusr": true,
    "xgrp": true,
    "xoth": true,
    "xusr": true
}
}
answered Apr 2 by Alia

Related Questions In Ansible

0 votes
1 answer

Get ansible commands return value

Hey @Hina, you can add the following ...READ MORE

answered Feb 4 in Ansible by Diana
227 views
0 votes
1 answer

How to regex replace nested values in Ansible

I'm not aware of any built-in method ...READ MORE

answered Jun 16, 2018 in Ansible by shubham
• 6,890 points
1,060 views
+1 vote
1 answer

Is it possible to append a large amount of text to a file using Ansible?

Here is concept which you can follow. blockinfile is ...READ MORE

answered Jul 30, 2018 in Ansible by Atul
• 10,240 points
2,747 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
179 views
0 votes
1 answer
0 votes
1 answer

How do I get a list of all Ansible variables?

Ansible by default gathers facts about machines ...READ MORE

answered Jan 30 in Ansible by Mahir
318 views
0 votes
1 answer

Can I upgrade Ansible with available modules of ansible?

Ansible can upgrade itself using pip module ...READ MORE

answered Feb 8 in Ansible by Dee
28 views