Update ohai to >= v18 for Ruby 3.1
Ruby 3.1 has been supported by ohai since v18.0. CI tests for ruby 3.2 have been added in v18.1. To upgrade to Ruby 3.1, we should update ohai to v18.0 or higher (currently v17.9).
This is a follow-up from #422257 (closed).