Hi Robroy,
tl;dr: I suggest making a new broker in /etc/puppetlabs/razor-server/brokers. Details about why are below.
The approach you took has the right idea, and there are a few different ways in Razor to achieve the desired outcome.
The key question is whether the file creation (in the sample case you described) is more a part of the installer (you wouldn't want to install the OS without the file being created) [this would be a new Task], or a part of the code that runs after, say, various OSes complete installation [this would be a new Broker].
My impression is that it probably makes more sense to do this in a broker, since it's code that runs after the installation is complete. Take a look at some of the brokers we have listed here:
In particular, the `noop` broker is a good starting point. All this broker does is report back to the server that the install is done:
Brokers in general are just code that triggers something to happen after the actual OS installation is complete. The `noop` broker-type does nothing, the `puppet` broker-type installs FOSS puppet, the `puppet-pe` broker-type installs PE puppet, etc. If you're using a different config management solution, I'd suggest creating a new broker-type.
Another best practice that seems valuable to mention is we generally avoid modifying the tasks, brokers, and hooks in /opt since that prevents future upgrades to those. If you want to take everything from one task but just override one file in it, there's a way to inherit from an existing task too, allowing you to modify just that one file.
Instead, I suggest looking in /etc/puppetlabs/razor-server/brokers and making the change (probably creating the path /etc/puppetlabs/razor-server/brokers/<name>.task). Doing this will allow you to reference <name> as a broker-type when you're creating a broker instance (in the `create-broker` command).
Hope that helps! Let me know if you have any other questions.