使用 puppet 将 bareos (bacula-fork) 部署到我的节点

使用 puppet 将 bareos (bacula-fork) 部署到我的节点

我不确定这是否是合适的提问地点,但我真的很想在我的服务器上puppet部署它。bareos

Bareos 是 Bacula 的一个分支,用于备份远程系统。

为此,bareos 使用一个服务器实例和不同的客户端实例(在我想要备份的每台服务器上)。

服务器实例连接到配置文件中可以找到的每个客户端。此外,当 Bareos 在配置文件中找到作业源时,它将运行备份作业。

配置文件集如下所示:

├── bareos-dir.conf
├── bareos-dir.conf.dist
├── bareos-dir.d
│   ├── webui-consoles.conf
│   └── webui-profiles.conf
├── bareos-fd.conf
├── bareos-sd.conf
├── bareos-sd.conf.dist
├── bareos-sd.d
├── bconsole.conf
├── bconsole.conf.dist
├── clients.d
├── director.d
├── storage.d
│   └── device-device.conf
└── tray-monitor.conf

默认情况下,客户端在其中定义,bareos-dir.conf但也可以包含来自其他目录的配置文件。

具有 Job 和 FileRessource 的客户端定义如下所示:

Client {  
  Name = test-fd  
  Address = test.example.com # the name has to be resolvable through DNS. 
  Password = "password which is defined in the file-daemon (client) of server test.example.com"                                     
}

此外还必须有一个像这样的 Job-Ressource:

Job {
   Name="test"
   JobDefs="DefaultJob"
   Client="test-fd"
   Pool = Incremental
   FileSet="pleskbackup"
}

以及如下的 FileSet-Ressource:

FileSet {
  Name = "pleskbackup"
  Include {
    Options {
      Signature = MD5 # calculate md5 checksum per file
    }
    File = /var/www
    File = /var/backup
    File = /var/qmail
  }
  # Things that usually have to be excluded
  # You have to exclude /var/lib/bareos/storage
  # on your bareos server
  Exclude {
  }

}

现在,如果我能用 puppet 管理备份就太好了。为此,我使用网络管理员/bareosprofile::backup::client。如果我只需添加到节点 XY,它就会自动安装bareos-fd (client file-daemon)并将其与我的 bareos 服务器连接起来,那就太好了。

我正在使用此配置文件为我的客户端安装 bareos:

class profile::backup::client {

    ## Install bareos client ##
        class   {
                'bareos':
                        manage_client   =>      'true',
        }   
}

此配置文件用于将 bareos 安装到我的 bareos 服务器:

class profile::backup::server {

    ## Install bareos server ##
    class   {
        'bareos':
            manage_client   =>  'true',
            manage_storage  =>  'true',
            manage_director =>  'true',
            manage_console  =>  'true', 
    }

    bareos::storage::device {
                'device':
                    media_type  =>  'File',
                    archive_device  =>  '/var/bareos/backup',
    }
}

好的 - 现在我可以将 bareos-clients 部署到我的客户端,将服务器部署到我的服务器 - 这已经起作用了(这很神奇 ;-) )。

我接下来要做什么:我想自动配置系统。因此,应将服务器配置为联系客户端(为此,服务器需要知道客户端的 FQDN 和给定的密码。客户端必须将 server-dir 应用为允许的目录。

我怎样才能做到这一点?

答案1

我对此采取了不同的方法。我认为在 Puppet 代码中重新设计 Bareos 配置指令(包括三个磁带驱动器、机器人、假脱机等)是浪费时间,因此我已将主要 Bareos 配置(bareos-dir.conf、bareos-sd.conf 等)放在单独的 Git 存储库中,该存储库被检出为 /etc/bareos。(显然我也可以使用 Puppet 逐字复制文件,但当时 Puppet 与 Bareos 配置的提交访问权限有不同的要求。)

为了配置作业和客户端,我使用自己的 Puppet 模块,该模块可以包含在所有客户端上,并且一切都可以正常工作;)

看一看:

https://github.com/kjetilho/rl-bareos

我有大约一千名客户,它对我来说非常有效。

相关内容