<commit_before>amandahosts = File.join(node['amanda_part']['amanda_data_dir'], '.amandahosts')
template amandahosts do
  owner node['amanda_part']['user']
  group node['amanda_part']['group']
  source '.amandahosts-server.erb'
  mode 0600
  variables(
    amanda_server_name: amanda_server_name,
    amanda_clients: CloudConductorUtils::Consul.read_servers
  )
  only_if { server? }
end

role_host_config.each do |role, role_host_backup_restore_config|
  role_host_backup_restore_config[:paths].each do |path_config|
    config = amanda_config(role, path_config[:path])
    [
      node['amanda_part']['amanda_dir'],
      node['amanda_part']['amanda_config_dir'],
      config[:config_dir],
      config[:vtapes_dir],
      config[:holding_dir],
      config[:info_dir],
      config[:log_dir],
      config[:index_dir],
      *config[:slot_dirs]
    ].each do |dir|
      directory dir do
        owner node['amanda_part']['user']
        group node['amanda_part']['group']
        mode 0755
        recursive true
        action :create
        only_if { server? && !File.exist?(dir) }
      end
    end

    disklist = File.join(config[:config_dir], 'disklist')
    template disklist do
      owner node['amanda_part']['user']
      group node['amanda_part']['group']
      source 'disklist.erb'
      mode 0644
      variables(
        hosts: role_host_backup_restore_config[:hosts],
        path_config: path_config
      )
      only_if { server? }
    end

    amanda_conf = File.join(config[:config_dir], 'amanda.conf')
    template amanda_conf do
      owner node['amanda_part']['user']
      group node['amanda_part']['group']
      source 'amanda.conf.erb'
      mode 0644
      variables(
        config: config,
        path_config: path_config
      )
      only_if { server? }
    end

    cron_conf = File.join('/etc/cron.d', config[:name])
    template cron_conf do
      owner node['amanda_part']['execuser']
      source 'cron.erb'
      mode 0644
      variables(
        config_name: config[:name],
        schedule: path_config[:schedule]
      )
      only_if { server? }
    end
  end
end
<commit_msg>Split backup_ready.rb into entry and server.<commit_after>include_recipe 'amanda_part::backup_ready_server' if amanda_server?

{'fraction_non_alphanumeric': 0.12122557726465365, 'fraction_numerical': 0.008880994671403197, 'mean_word_length': 3.1263736263736264, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2553520', 'n_tokens_mistral': 751, 'n_tokens_neox': 730, 'n_words': 137}