Greetings BalticBrewer - I assume you're referring to a home brewing application. If so, yes, it can be done rather simply. However, using a solenoid, you would have only a two-stage burner. If you're looking for a variable BTU output from your burner, say from 20% to 100%, it would take a modulating drive style valve and either a PID (Proportional Integral Derivative) solid state controller or you can go with a resistive controller at a lesser cost and no programming involved, but less accurate.
In either case, being you're dealing with natural or propane gase, I highly recommend the system is an engineered system. I have not seen anything on the market that will accomplish modulation on a burner for a home brewing application. That doesn't mean it doesn't exist, I have simply never seen one for a home brewing application.
Lastly, I'm not familiar with a Raspberry Pi or a Craft Beer Pi scenario. Perhaps you can elaborate?