Skip to content

gitlab-ci-runner (4.1.1) ResourceNotFound: Cannot find a resource matching template[/etc/gitlab-runner/config.toml] (did you define it first?)

The invocation modified for this year's runner reg ritual from what works in 2.1.1:

package 'gitlab-runner'
gitlab_ci_runner_service 'gitlab-runner'

gitlab_ci_runner_runner "#{ [ node[:hostname], *[*node.run_state.dig(cookbook_name, recipe_name, 'tags')||[]].join('-')].join('-') }" do
# registration_token    node.run_state.dig(cookbook_name, recipe_name, 'reg_token')
  token                 node.run_state.dig(cookbook_name, recipe_name, 'token')
  url                   node.run_state.dig(cookbook_name, recipe_name, 'url')
  tag_list              [*(node.run_state.dig(cookbook_name, recipe_name, 'tags')||[])]
  options               ({
                           "executor" => "shell"
                         }.merge((node.run_state.dig(cookbook_name, recipe_name, 'options')||{})
                                   .to_h.slice(*%w(environment))))
  sensitive             false
#  action                :register
  action                :create
end

Generates this function:

192.168.24.112     gitlab_ci_runner_runner("otter-runner-terraform") do
192.168.24.112       action [:create]
192.168.24.112       default_guard_interpreter :default
192.168.24.112       declared_type :gitlab_ci_runner_runner
192.168.24.112       cookbook_name "linux-gitlab-runner"
192.168.24.112       recipe_name "install"
192.168.24.112       token "*sensitive value suppressed*"
192.168.24.112       url "http://gitlab/"
192.168.24.112       tag_list ["runner", "terraform"]
192.168.24.112       options {"executor"=>"shell"}
192.168.24.112       config_file "/etc/gitlab-runner/config.toml"
192.168.24.112       owner "gitlab-runner"
192.168.24.112       group "gitlab-runner"
192.168.24.112     end

and the error mentioned at top:

192.168.24.112 Chef Client failed. 0 resources would have been updated
192.168.24.112 [2024-10-25T12:20:03-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
192.168.24.112 [2024-10-25T12:20:03-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
192.168.24.112 [2024-10-25T12:20:03-07:00] FATAL: Chef::Exceptions::ResourceNotFound: gitlab_ci_runner_runner[otter-runner-terraform] (linux-gitlab-runner::install line 29) had an error: Chef::Exceptions::ResourceNotFound: Cannot find a resource matching template[/etc/gitlab-runner/config.toml] (did you define it first?)

Has anyone seen this issue? I'm assuming I don't need to template the config.toml because I'm neither setting it nor taking it over, but it seems weird.