0

I'd like to add post-up and post-down commands to my network interfaces. Can salt.states.network do that ?

If not what would be the best way to add them using salt knowing that I can't simply add them at the end of the file since there is other interfaces.

1 Answer 1

3

Debian is nice in using .d run-parts directories.

Just put a script in /etc/network/if-post-up.d/ and /etc/network/if-post-down.d/ and you're done.

For example:

add_route_up_script:
  file.managed:
    - name: /etc/network/if-up.d/my-route
    - mode: 0755
    - source: salt://network/if-up-route

See interfaces(5) for available environment variables like IFACE, METHOD, etc. These are the same as in interfaces file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .