Alex
You're looking for 'Requires' -
See https://docs.puppet.com/puppet/latest/reference/lang_relationships.html
Basically, you can add "requires => Logical_Volume['lv_pgdata']" to the
'postgresql::server' class, and if the Logical_Volume resource fails for
whatever reason, then the 'postgresql::server' class will be skipped...
HTH
Gav
On Tuesday, 16 August 2016 02:16:48 UTC+1, Alex Samad wrote:
>
> Hi
>
> I would like to setup my LVM first
> PV
> VG
> PV
> mount that in /var/lib/pgsql/9.2/data and then use
>
> # default
> class { 'postgresql::globals':
> manage_package_repo => false,
> version => '9.2',
> }->
> class { 'postgresql::server':
> }
>
>
> now for testing I haven't installed /dev/sdc which is my phys disk for the
> vg..
>
> I would like the install of postgress to fail
>
>
>
> # predefined mounts
> # not done via lvm - can't do labels !
>
> # setup PG Data directory first
> file { '/var/lib/pgsql':
> ensure => 'directory',
> group => '26',
> mode => '0700',
> owner => '26',
> }
>
> file { '/var/lib/pgsql/9.2/':
> ensure => 'directory',
> group => '26',
> mode => '0700',
> owner => '26',
> }
>
> # incuded as part of the postgres module
> # file { '/var/lib/pgsql/9.2/data':
> # ensure => 'directory',
> # group => '26',
> # mode => '0700',
> # owner => '26',
> # }
>
> filesystem { '/dev/vg_pgdata/lv_pgdata':
> ensure => 'present',
> fs_type => 'ext4',
> options => '-L ybPGData',
> }
>
> mount { '/var/lib/pgsql/9.2/data':
> ensure => 'mounted',
> device => 'LABEL=ybPGData',
> dump => '1',
> fstype => 'ext4',
> options => 'defaults',
> pass => '2',
> target => '/etc/fstab',
> }
>
> volume_group { 'vg_pgdata':
> ensure => present,
> physical_volumes => '/dev/sdc1'
> }
>
> logical_volume { 'lv_pgdata':
> ensure => present,
> volume_group => 'vg_pgdata',
> size => '20G',
> }
>
>
>
> #
> # latest postgres rpm
> #
> package { 'pgdg-centos92-repo':
> name => 'pgdg-centos92',
> ensure => 'installed',
> provider => 'rpm',
> source => '
> https://download.postgresql.org/pub/repos/yum/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-7.noarch.rpm
> ',
> install_options => [
> '--httpproxy',
> 'proxyyb',
> '--httpport',
> '3128',
> ]
> }
>
> # have to overwrite the repo file
> file { 're_pgdg-centos92':
> ensure => present,
> path => '/etc/yum.repos.d/pgdg-92-centos.repo',
> content => file('profile/ybpostgresql92/pgdg-92-centos.repo'),
> owner => 'root',
> group => 'root',
> mode => 'u=rw,g=r,o=r',
> }
>
>
> # default
> class { 'postgresql::globals':
> manage_package_repo => false,
> version => '9.2',
> }->
> class { 'postgresql::server':
> }
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/9b028628-3b87-40d6-b62e-7833b5448a52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.