Thanks Kai, I did the same as suggested by you to find the ifcfg-* but when
i register the variable say result. the output of the result variable shows
the entire list of attributes of the file, we need to get only the name of
the interface but what the output is as below..could you please suggest as
to how to curtail the output to give interface name:

the output shows as below :

 {
                "atime": 1511964673.1590006,
                "ctime": 1511420044.9254873,
                "dev": 2051,
                ..................................
                "isreg": true,
                "issock": false,
                "isuid": false,
                "mode": "0644",
                "mtime": 1511420044.9214873,
                "nlink": 1,
                "path": "/etc/sysconfig/network-scripts/ifcfg-eno16777736",
                "rgrp": true,
                "roth": true,
}


 {
                "atime": 1511964673.1320007,
                "ctime": 1511852951.9169016,
                "dev": 2051,
                "gid": 0,
                "inode": 101194774,
                "isblk": false,
                "issock": false
                 .....................
                "isuid": false,
                "mode": "0644",
                "mtime": 1511852951.9169016,
                "nlink": 1,
                "path":
"/etc/sysconfig/network-scripts/ifcfg-Ethernet_connection_1",
                "rgrp": true,
                "roth": true,
                "rusr": true,
}


On Tue, Nov 28, 2017 at 8:27 PM, Kai Stian Olstad <
[email protected]> wrote:

> On Tuesday, 28 November 2017 15.36.34 CET coach rhca wrote:
> >
> > thanks Kai, actually trying to edit a parameter in the network  interface
> > files I am using something like
> > lineinfile: "dest=/etc/sysconfig/network-scripts/*ifcfg-{{
> > ansible_default_ipv4.interface }*} regexp='^{{ item.regexp }}' line='{{
> >  item.line }}'"
> >
> >
> > but this only gives me the default network card but i want to edit the
> > changes in all the available network interfaces like ifcfg-en0117 or
> > ifcfg-en037 whatever is present in the host except the lo
> interface..could
> > you please suggest as to how we can do on multiple interface...thank you
> .
>
> I would use the find module to find ifcfg-* in /etc/sysconfig/network-scripts/
> and exclude ifcfg-lo.
> Register the output in a variable and loop over the entries in the
> varaible with with_items on lineinfile.
>
>
> --
> Kai Stian Olstad
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/Jj4e_dFxiW4/unsubscribe.
> To unsubscribe from this group and all its topics, 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/2308705.zYZqbabTxQ%40x1.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALguqPJ2XdB1iXY73vSjTJVYaMqEBFzAjr5ch%2B_GE79kt%3DG_%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to