{"comment":{"url":"https://api.github.com/repos/jvonau/xsce/comments/9762592","html_url":"https://github.com/jvonau/xsce/commit/1482fe304bf04866bb1af5cbcd098d840d9b3571#commitcomment-9762592","id":9762592,"user":{"login":"tim-moody","id":5678731,"avatar_url":"https://avatars.githubusercontent.com/u/5678731?v=3","gravatar_id":"","url":"https://api.github.com/users/tim-moody","html_url":"https://github.com/tim-moody","followers_url":"https://api.github.com/users/tim-moody/followers","following_url":"https://api.github.com/users/tim-moody/following{/other_user}","gists_url":"https://api.github.com/users/tim-moody/gists{/gist_id}","starred_url":"https://api.github.com/users/tim-moody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tim-moody/subscriptions","organizations_url":"https://api.github.com/users/tim-moody/orgs","repos_url":"https://api.github.com/users/tim-moody/repos","events_url":"https://api.github.com/users/tim-moody/events{/privacy}","received_events_url":"https://api.github.com/users/tim-moody/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":"","commit_id":"1482fe304bf04866bb1af5cbcd098d840d9b3571","created_at":"2015-02-16T14:17:13Z","updated_at":"2015-02-16T14:17:13Z","body":"I recall checking for that problem.  My memory is that I concluded that ansible filters out inactive interfaces, but you’d have to check.  This becomes a broader problem if you want to setup a gateway with only wan connected.\n\nFrom: Jerry Vonau \nSent: Sunday, February 15, 2015 8:56 PM\nTo: jvonau/xsce \nCc: Tim Moody \nSubject: Re: [xsce] grep doesn't like blanks or {} use none, then set blank, auto as default (1482fe3)\n\n- name: Discover LAN iface\nset_fact:\ndiscovered_lans: \"{{ item.1 }}\"\nwhen: item.1 != \"lo\" and item.1 != \"tun\" and item.1 !=\n\"{{xsce_wan_iface}}\"\nwith_indexed_items: ansible_interfaces\n- debug: msg=\"found {{discovered_lans}} as LAN\"\n\ngives this:\nTASK: [network | Discover LAN iface]\n******************************************\nskipping: [127.0.0.1] => (item=(0, u'lo'))\nok: [127.0.0.1] => (item=(1, u'wlan0'))\nok: [127.0.0.1] => (item=(2, u'eth1'))\nskipping: [127.0.0.1] => (item=(3, u'eth0'))\n\nTASK: [network | debug msg=\"found {{discovered_lans}} as LAN\"]\n****************\nok: [127.0.0.1] => {\n\"item\": \"\",\n\"msg\": \"found eth1 as LAN\"\n}\n\nPart of the problem is with this code there is no checking if the interface\nis active like the shell code handled with the -e DOWN part. Both shell and\nthis code only selects the first available interface.\n\nOn Sat, Feb 14, 2015 at 1:04 PM, Jerry Vonau <jvonau3@gmail.com> wrote:\n\n> For the future I think the shell scripting can go away with parsing\n> ansible_interfaces. Auto means just that, none is user supplied override or\n> computed by auto, anything else is passed as an interface name if present\n> in vars/ as an available override.\n>\n> On Sat, Feb 14, 2015 at 9:23 AM, Tim Moody <notifications@github.com>\n> wrote:\n>\n>> I really dislike the shell script that tries to discover the lan. Santi\n>> revised it several times as did I and there are still problems.\n>>\n>> I started down the road of doing everything in ansible and I still like\n>> the idea if it can be made to work.\n>>\n>> First, I think we are jumping through too many hoops over\n>> ansible_default_ipv4.interface, which we do need to be able to detect if it\n>> exists. I propose something like (with proper syntax):\n>>\n>> set_fact\n>> discovered_wan: ansible_default_ipv4.interface\n>> when: ansible_default_ipv4.interface is defined\n>>\n>> set_fact\n>> discovered_wan: 'none'\n>> when: ansible_default_ipv4.interface is not defined\n>>\n>> - name: Discover Lan Interface set_fact: xsce_lan_iface: \"{{ item.1\n>> }}\" when: item.1 != \"lo\" and \"{{ item.1 }}\" != \"{{ discovered_wan }}\"\n>> with_indexed_items: ansible_interfaces\n>>\n>> (we may need to get tun into the above list)\n>>\n>> I'm not sure why some stanzas use interface and some use alias as they\n>> seem identical.\n>>\n>> Does xsce_wan_iface: auto mean detect and set to discovered device if\n>> found?\n>> Does xsce_lan_iface: auto mean set to 172.18.96.1 if found?\n>>\n>> Does none mean don't configure even if you find one?\n>>\n>> —\n>> Reply to this email directly or view it on GitHub\n>> <https://github.com/jvonau/xsce/commit/1482fe304bf04866bb1af5cbcd098d840d9b3571#commitcomment-9749120>\n>> .\n>>\n>\n>\n\n—\nReply to this email directly or view it on GitHub.\n"}}