name "eddie"
description "Master role applied to eddie"

default_attributes(
  :apt => {
    :sources => ["postgresql"]
  },
  :db => {
    :cluster => "9.5/main"
  },
  :networking => {
    :interfaces => {
      :internal_ipv4 => {
        :interface => "enp1s0f0.2801",
        :role => :internal,
        :family => :inet,
        :address => "10.0.0.10"
      }
    }
  },
  :postgresql => {
    :settings => {
      :defaults => {
        :shared_buffers => "64GB",
        :work_mem => "64MB",
        :maintenance_work_mem => "1GB",
        :effective_cache_size => "180GB",
        :effective_io_concurrency => "256",
        :random_page_cost => "1.1"
      }
    }
  },
  :sysctl => {
    :postgres => {
      :comment => "Increase shared memory for postgres",
      :parameters => {
        "kernel.shmmax" => 66 * 1024 * 1024 * 1024,
        "kernel.shmall" => 66 * 1024 * 1024 * 1024 / 4096
      }
    }
  }
)

run_list(
  "role[ucl]",
  "role[db-slave]"
)
