File: Vagrantfile

package info (click to toggle)
check-pgbackrest 1.9-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 716 kB
  • sloc: sh: 1,238; perl: 868; makefile: 41; sql: 25
file content (108 lines) | stat: -rw-r--r-- 4,178 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
pgver = '12' # pg version to use
vm_prefix = 'c_pgbr_c7'
encrypted_repo = 'false'

Vagrant.configure(2) do |config|

	pgdata = "/var/lib/pgsql/#{pgver}/data"

    config.vm.box = 'centos/7'

    # hardware and host settings
    config.vm.provider 'libvirt' do |lv|
        lv.cpus = 1
        lv.memory = 2048
        lv.default_prefix = vm_prefix
	end

    # don't mind about insecure ssh key
    config.ssh.insert_key = false

    # don't share the default vagrant folder
    config.vm.synced_folder ".", "/vagrant", disabled: true

    # mount check_pgbackrest path for testing
    config.vm.synced_folder "..", "/check_pgbackrest", nfs_udp: false
    if File.directory?(File.expand_path("../../pgbackrest-dev"))
        config.vm.synced_folder "../../pgbackrest-dev", "/pgbackrest-dev", nfs_udp: false
    end

    # check_pgbackrest install on all the nodes
    config.vm.provision 'check_pgbackrest', type: 'shell', path: 'provision/check_pgbackrest.bash'

    # install PostgreSQL on all the nodes
    config.vm.provision 'pgsql', type: 'shell', 
        path: 'provision/pgsql.bash', 
        args: [ pgver, pgdata ]

    # ssh configuration
    config.vm.synced_folder 'ssh', '/root/.ssh', type: 'rsync',
        owner: 'root', group: 'root',
        rsync__args: [ "--verbose", "--archive", "--delete", "--copy-links", "--no-perms" ]

    # system setup for all nodes
    config.vm.define "icinga-srv" do |icinga|
        icinga.vm.hostname = "icinga-srv"

        # icinga2 local setup. Use "vagrant up --provision-with=icinga2"
        icinga.vm.provision 'icinga2', type: 'shell',
        path: 'provision/icinga2.bash', run: 'never'

        # pgbackrest local setup. Use "vagrant up --provision-with=icinga2_local"
        icinga.vm.provision 'icinga2_local', type: 'shell',
          path: 'provision/icinga2_local.bash', run: 'never'

        # pgbackrest remote setup. Use "vagrant up --provision-with=icinga2_remote"
        icinga.vm.provision 'icinga2_remote', type: 'shell',
          path: 'provision/icinga2_remote.bash', run: 'never'

        # pgbackrest minio setup. Use "vagrant up --provision-with=icinga2_minio"
        icinga.vm.provision 'icinga2_minio', type: 'shell',
          path: 'provision/icinga2_minio.bash', run: 'never'
    end

    config.vm.define "pgsql-srv" do |pgsql|
        pgsql.vm.hostname = "pgsql-srv"
 
        # pgbackrest local setup. Use "vagrant up --provision-with=pgbackrest_local"
        pgsql.vm.provision 'pgbackrest_local', type: 'shell',
          path: 'provision/pgbackrest_local.bash',
            args: [ pgver, pgdata, encrypted_repo ],
            run: 'never'
 
        # pgbackrest remote setup. Use "vagrant up --provision-with=pgbackrest_remote_primary"
        pgsql.vm.provision 'pgbackrest_remote_primary', type: 'shell',
          path: 'provision/pgbackrest_remote_primary.bash',
            args: [ pgver, pgdata ],
            run: 'never'
 
        # pgbackrest minio setup. Use "vagrant up --provision-with=pgbackrest_minio"
        pgsql.vm.provision 'pgbackrest_minio', type: 'shell',
          path: 'provision/pgbackrest_minio.bash',
            args: [ pgver, pgdata, encrypted_repo ],
            run: 'never'
    end

    config.vm.define "backup-srv" do |backup|
        backup.vm.hostname = "backup-srv"
 
        # cifs share to store pgbackrest backups. Use "vagrant up --provision-with=cifs"
        backup.vm.provision 'cifs', type: 'shell',
          path: 'provision/cifs.bash', run: 'never'

        # pgbackrest remote setup. Use "vagrant up --provision-with=pgbackrest_remote_standby"
        backup.vm.provision 'pgbackrest_remote_standby', type: 'shell',
          path: 'provision/pgbackrest_remote_standby.bash',
            args: [ pgver, pgdata, encrypted_repo ],
            run: 'never'

        # minio local setup. Use "vagrant up --provision-with=minio"
        backup.vm.provision 'minio', type: 'shell', 
          path: 'provision/minio.bash', run: 'never'

        # minio http setup. Use "vagrant up --provision-with=minio_http"
        backup.vm.provision 'minio_http', type: 'shell', 
          path: 'provision/minio_http.bash', run: 'never'
    end

end