I'm not sure doing it by version of Ubuntu spun up is a good way to do it, but doing a register / stat.exists works, but I think it should be done based on the items specifically listed.