Got it. Do the hooks and hotplugs need to be configured manually? or Can it be automatically pushed through templates and executed? Regards, Sai
On Fri, Jul 29, 2022 at 3:52 PM Federico Capoano <[email protected]> wrote: > Dear Sai, > > I already pointed out to you how to do what you need, now is up to you to > read the docs, try out the examples and implement it. > If you have more specific questions about steps that are not clear to you > please do not hesitate to ask. > > Best regards > *Federico Capoano* > OpenWISP OÜ > Harjumaa, Tallinn, Sepapaja tn 6, 15551 > VAT: EE101989729 > *openwisp.io* <http://openwisp.io> > > > On Fri, Jul 29, 2022 at 1:39 PM Sai Subramanian <[email protected]> > wrote: > >> Hi Fed, >> >> Thanks a lot for your quick reply. >> Sure, I will check whether the script is working before I start with >> OpenWisp. >> >> I am trying to achieve ZTP (Zero Touch Provisioning) with OpenWISP where >> I want the below commands to be executed on the OpenWRT device once it is >> on-boarded to OpenWISP: >> >> - uci del firewall.zone2.network >> - uci add_list firewall.zone2.network='wan' >> - uci add_list firewall.zone2.network='wg13' >> >> As per my knowledge I want to push a bash file containing these commands >> and execute it : >> >> - I am able to push the file to the OpenWRT device and automatically >> execute it by using templates. >> - I am able to push the file but the problem is that I am not able to >> execute the file automatically. >> - Can you please share the steps in which I can use OpenWISP to >> automatically execute the bash file after it has been pushed to the >> device? >> >> Please let me know if this is possible, if so, requesting you to please >> share the steps which I can follow to fulfil the above requirement. >> >> Regards, >> Sai >> >> On Fri, Jul 29, 2022 at 2:23 PM Federico Capoano <[email protected]> >> wrote: >> >>> Hi Sai, >>> >>> If by onboarding you mean the event when the device is first recognized >>> by the system and registers itself, then we have a specific hook for it: >>> https://github.com/openwisp/openwisp-config/#hooks, see the post >>> registration hook. >>> >>> If you are compiling from master or using the builds from >>> downloads.openwisp.io, you can also use the new hotplug events: >>> https://github.com/openwisp/openwisp-config/#hotplug-events >>> >>> That will allow you to add any logic you need. >>> >>> For example, you could deploy scripts via OpenWISP templates, hook them >>> to the post config reload event, which is triggered after the new config >>> has been applied, and execute the scripts. In case you need the scripts to >>> run only once you just need to write a control file somewhere in the >>> permanent flash storage (eg: /etc/openwisp) and check whether that file >>> exists before doing anything, if it exists, you simply exit, if it doesn't >>> you let the script proceed. >>> >>> It may sound obvious to some but I need to reiterate that I highly >>> recommend to try this manually first and only once you are 100% sure that >>> the scripts you prepared work, only then put those scripts in OpenWISP as >>> templates and test the full flow. >>> Some people try to do it all at once and end up bombarding us with >>> questions which most of the time do not have to do anything with OpenWISP >>> but with their lack of understanding of OpenWrt. >>> >>> Best regards >>> *Federico Capoano* >>> OpenWISP OÜ >>> Harjumaa, Tallinn, Sepapaja tn 6, 15551 >>> VAT: EE101989729 >>> *openwisp.io* <http://openwisp.io> >>> >>> >>> On Thu, Jul 28, 2022 at 8:52 AM Sai Subramanian <[email protected]> >>> wrote: >>> >>>> Hi team, >>>> >>>> I have been working on OpenWisp for my personal research related work >>>> and I am happy with your product. >>>> >>>> I have been facing a challenge the with your software, where I am not >>>> able to create custom built templates. >>>> >>>> For example, I want to create a template which can run few commands on >>>> the OpenWRT device when the onboard. Can you please guide me on how I can >>>> build custom templates to achieve the above requirement? >>>> >>>> Regards, >>>> Sai >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "OpenWISP" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web, visit >>>> https://groups.google.com/d/msgid/openwisp/0f0eda32-c886-477e-8658-cedffa0dd24fn%40googlegroups.com >>>> <https://groups.google.com/d/msgid/openwisp/0f0eda32-c886-477e-8658-cedffa0dd24fn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "OpenWISP" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/openwisp/3A_s51rJdcE/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To view this discussion on the web, visit >>> https://groups.google.com/d/msgid/openwisp/CAAGgX6JoEVQo%3D8Pxw2TqGQhGnT8cgA2sMhojv6Q3TjD3w0xf1A%40mail.gmail.com >>> <https://groups.google.com/d/msgid/openwisp/CAAGgX6JoEVQo%3D8Pxw2TqGQhGnT8cgA2sMhojv6Q3TjD3w0xf1A%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "OpenWISP" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web, visit >> https://groups.google.com/d/msgid/openwisp/CAJ-rO8ZSHjjfsZKQeufQV-XzsS7nKuS28SC1nNZZjmoyhs2mmg%40mail.gmail.com >> <https://groups.google.com/d/msgid/openwisp/CAJ-rO8ZSHjjfsZKQeufQV-XzsS7nKuS28SC1nNZZjmoyhs2mmg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "OpenWISP" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/openwisp/3A_s51rJdcE/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web, visit > https://groups.google.com/d/msgid/openwisp/CAAGgX6%2BcJ5x4Le2m_RHCKqhj4jf3hguBg8nB3FpnxTfxB3ebOg%40mail.gmail.com > <https://groups.google.com/d/msgid/openwisp/CAAGgX6%2BcJ5x4Le2m_RHCKqhj4jf3hguBg8nB3FpnxTfxB3ebOg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "OpenWISP" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/openwisp/CAJ-rO8anJXPqS13pJBy74tYmYMgZpY5JK5W7qKc5KqmNFRK46A%40mail.gmail.com.
