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
9 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
25 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,500 points
591 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,200 points
1,432 views
+13 votes
2 answers
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
95 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
9 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.