ansible --version
ansible 2.2.1.0
config file = /etc/ansible/ansible.cfg
Am using find modules to get largest files and its size the file, I am
getting a big jason format output, How can i parse one particular string
from the output.
I need to fetch only the "path" and "size" values from here. Can anyone
help me on this?
------------------------------
- hosts: localhost
connection: local
become: true
vars:
var1: '{{ choice }}'var2: '{{ fspath }}'gather_facts: true
tasks:
-
find: paths="/var/log" age="0d" size="1m" patterns="*.old,*.log"
recurse=yes
register: logfile
when: var1 == "getLogs"
-
name: "display the big files
-
debug: var=logfile
=================================================================
output:
"logfile": {
"changed": false,
"examined": 62,
"files": [
{
"atime": 1492683835.282168,
"ctime": 1501012553.91998,
"dev": 51713,
"gid": 0,
"inode": 25975339,
"isblk": false,
"ischr": false,
"isdir": false,
"isfifo": false,
"isgid": false,
"islnk": false,
"isreg": true,
"issock": false,
"isuid": false,
"mode": "0644",
"mtime": 1501012553.91998,
"nlink": 1,
"path": "/var/log/ansible.log",
"rgrp": true,
"roth": true,
"rusr": true,
"size": 2070175,
"uid": 0,
"wgrp": false,
"woth": false,
"wusr": true,
"xgrp": false,
"xoth": false,
"xusr": false
--
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/07fe9434-d739-432b-aed0-064257e880bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.