I defined a simple class for mount a nfs share on host as follow(current)
class mounts {
file { [ "/mnt/share", "/mnt/share/share1" ]:
ensure => 'directory',
}
mount { '/mnt/share/share1':
ensure => 'mounted',
device => '192.168.122.1:/home/export',
dump => '0',
fstype => 'nfs',
options => 'vers=3,defaults',
pass => '0',
require => File[ "/mnt/share", "/mnt/share/share1" ],
}
}
So now i have an entry in /etc/fstab on the puppet client
192.168.122.1:/home/export /mnt/share/share1 nfs vers=3,defaults 0 0
My problem is, the puppet class was defined in this way(OLD)
class mounts {
file { '/mnt/nfs':
ensure => 'directory',
}
mount { '/mnt/nfs':
ensure => 'mounted',
device => '192.168.122.1:/home/export',
dump => '0',
fstype => 'nfs',
options => 'vers=3,defaults',
pass => '0',
require => File[ "/mnt/nfs" ],
}
}
And now i have two entries in the /etc/fstab
192.168.122.1:/home/export /mnt/nfs nfs vers=3,defaults 0 0 #OLD
192.168.122.1:/home/export /mnt/share/share1 nfs vers=3,defaults 0 0 #NEW
why puppet doesn't remove the old entry?
Puppet doesn't automatically remove something, just because it managed a setting in the past and the old resource no longer applies.
If you want to remove that old mount, then remove it with a with something like this.