i think there is already a hook?
https://github.com/theforeman/foreman/blob/develop/app/models/host/managed.rb#L26