Solved this problem in the following way:
class base :: nginx {
file { "vim_nginx": ensure => 'present', path => '/tmp/puppet/vim_nginx.sh', source => 'puppet:///modules/base/vim_nginx.sh', mode => '774', } exec { "highlighting": command => 'bash /tmp/puppet/vim_nginx.sh', path => "/usr/bin:/usr/sbin:/bin", require => File['vim_nginx'], onlyif => 'test -e /etc/nginx/nginx.conf' }
}
Those. here I created a script that sets syntax highlighting, is copied to all servers belonging to a given class. Next, the test for the presence of the /etc/nginx/nginx.conf file works, which confirms whether nginx is installed or not. If yes, then run the script.
In principle, this can be used with any other dependencies or even improve the logic of work.