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, 2019 in Ansible by Rani

1 answer to this question.

0 votes

Hey @Rani, you could try something like this:

ansible  -m stat -a "path=/appserver" | 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, 2019 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, 2019 in Ansible by Diana
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 17, 2018 in Ansible by shubham
• 7,320 points
0 votes
1 answer
+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,230 points
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
+2 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 31, 2019 in Ansible by Mahir
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, 2019 in Ansible by Dee