I'm trying to set a custom .vimrc
profile on all servers in the production environment by using Puppet.
I wrote the following manifest:
class vim {
file { "/etc/skel/.vimrc":
path => '/etc/skel/.vimrc',
ensure => present,
mode => "664",
source => "puppet:///modules/vim/.vimrc",
}
}
file { "/root/.vimrc":
path => '/root/.vimrc',
ensure => present,
mode => "664",
source => "puppet:///modules/vim/.vimrc",
}
}
The first part of the manifest works like a charm and adds a .vimrc
file to /etc/skel
, but for some reason, the second part doesn't work, even though you can see it's exactly the same configuration apart from the path, the path in the second section is root's home directory.
Is there a reason why Puppet ignores this section?
Is that because it has some defenses when it comes to root's home folder?
Edit #1:
[root@sgproxy04 ~]# ls -la /root/
total 2452
dr-xr-x---. 3 root root 4096 2015-02-10 10:53 .
dr-xr-xr-x. 27 root root 4096 2015-01-12 09:31 ..
-rw-------. 1 root root 9423 2013-07-17 14:19 anaconda-ks.cfg
-rw------- 1 root root 14032 2015-02-10 10:55 .bash_history
-rw-r--r--. 1 root root 18 2009-05-20 10:45 .bash_logout
-rw-r--r-- 1 root root 196 2014-11-17 12:16 .bash_profile
-rw-r--r--. 1 root root 176 2004-09-23 03:59 .bashrc
-rw-r--r--. 1 root root 9545 2013-07-17 14:21 cobbler.ks
-rw-r--r--. 1 root root 100 2004-09-23 03:59 .cshrc
-rwxr-xr-x. 1 root root 396 2013-07-10 07:33 hosts.sh
-rw-r--r--. 1 root root 17440 2013-07-17 14:19 install.log
-rw-r--r--. 1 root root 12476 2013-07-17 14:19 install.log.syslog
-rw-r--r--. 1 root root 2382545 2013-07-17 14:21 ks-post.log
-rw-r--r--. 1 root root 3572 2013-07-17 14:17 ks-pre.log
drwx------ 2 root root 4096 2014-09-15 07:45 .ssh
-rw-r--r--. 1 root root 129 2004-12-03 21:42 .tcshrc
-rw-rw-r-- 1 root root 0 2014-12-18 16:14 testfile2.dat
-rw-rw-r-- 1 root root 0 2014-12-18 16:14 testfile.dat
-rw------- 1 root root 6757 2015-02-10 10:53 .viminfo
[root@sgproxy04 ~]#
Edit #2:
When running puppet agent -t
on the client, I get the following output:
[root@sgproxy04 ~]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: syntax error on line 11, col 4: ` ensure => present,' at /etc/puppet/environments/production/manifests/site.pp:1 on node sgproxy04.sg.company.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
[root@sgproxy04 ~]#
When checking the problematic file in the Puppet server:
[root@foreman fqdns]# cat /etc/puppet/environments/production/manifests/site.pp
hiera_include("classes", [])
Package { allow_virtual => false, }
node default {
}
[root@foreman fqdns]#
As you can see, it says there's an issue with line 11 but there are only 5 lines in the file.