- name: "install perl / git dependencies"
  include_role:
    name: yum_apt_retry
  vars:
    rpm:
      - perl-ExtUtils-Manifest
      - perl-ExtUtils-Install
      - perl-File-Which
      - perl-IPC-Cmd
    creates:
      - "/usr/share/perl5/vendor_perl/ExtUtils/Manifest.pm,/usr/share/perl/*/ExtUtils/Manifest.pm"
      - "/usr/share/perl5/vendor_perl/ExtUtils/Install.pm,/usr/share/perl5/ExtUtils/Install.pm"
      - /usr/share/perl5/vendor_perl/File/Which.pm
      - /usr/share/perl5/vendor_perl/IPC/Cmd.pm

- name: "install Monitoring::Generator::TestConfig"
  shell: "sudo su - {{ site }} -c 'cpanm -n Monitoring::Generator::TestConfig'"
  args:
    creates: "/omd/sites/{{ site }}/local/lib/perl5/lib/perl5/Monitoring/Generator/TestConfig.pm"

- stat: path=/thruk
  register: thruk_path
- name: "run create_monitoring_test_config.pl"
  shell: "sudo su - {{ site }} -c 'create_monitoring_test_config.pl'"
  when: thruk_path.stat.exists
