Report abuse

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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
class vmware {
#if $lsbmajdistrelease {
  $vmwarever_real = $vmwarever ? {
    ''      => '4.1u1',
    default => "$vmwarever",
  }

  case $productname {
    'VMware Virtual Platform': {
      package { "VMwareTools":
        ensure  => "absent",
        before => Package["vmware-tools"],
      }

      package { "vmware-tools":
        ensure  => "latest",
        name    => $operatingsystem ? {
          Fedora  => "open-vm-tools",
          /(?i:suse|opensuse|sles)/ => Package ["vmware-tools-esx-nox"],
          default => "vmware-tools-esx-nox",
        },
        require => $operatingsystem ? {
          Fedora => Package ["VMwareTools"],
          /(?i:suse|opensuse|sles)/ => Package ["VMwareTools"],
          default => [ Yumrepo["vmware"], Package ["VMwareTools"], Package ["vmware-erase"], ],
        },
      }

      exec { "vmware-uninstall-tools":
        command => "/usr/bin/vmware-uninstall-tools.pl",
        path    => "/usr/bin:/usr/local/bin",
        onlyif  => "test -f /usr/bin/vmware-uninstall-tools.pl",
        before  => [ Package["vmware-tools"], Package["VMwareTools"], ],
      }

      exec { "vmware-uninstall-tools-local":
        command => "/usr/local/bin/vmware-uninstall-tools.pl",
        path    => "/usr/bin:/usr/local/bin",
        onlyif  => "test -f /usr/local/bin/vmware-uninstall-tools.pl",
        before  => [ Package["vmware-tools"], Package["VMwareTools"], ],
      }

      package { "/^vmware-(open|tools)-\w+$/":
        ensure => "absent",
        before  => [ Package["vmware-tools"], Package["VMwareTools"], ],
        alias => "vmware-erase",
      }
      #exec { "vmware-uninstall-tools-yum":
      #  command => "yum erase -y vmware-*",
      #  path    => "/bin:/usr/bin:/usr/local/bin",
      #  onlyif  => "test -f /usr/bin/vmware-uninstall-tools.pl",
      #  before  => [ Package["vmware-tools"], Package["VMwareTools"], ],
      #}

      # tools.syncTime = "TRUE" should be in the guest's vmx file.
      # http://kb.vmware.com/kb/1006427
      exec { "vmware-tools.syncTime":
        command     => 'vmware-guestd --cmd "vmx.set_option synctime 1 0" || true',
        path        => "/usr/bin:/usr/local/bin",
        returns     => [ 0, 1, ],
        require     => Package["vmware-tools"],
        refreshonly => true,
      }

      $yum_basearch = $architecture ? {
        'i386'  => 'i686',
        default => "$architecture",
      }
      $zypp_basearch =  $architecture ? {
        'i386' => 'i586',
        default => "$architecture",
      }

      case $operatingsystem {
        CentOS, RedHat, OEL: {
          yumrepo { "vmware":
            descr    => "VMware Tools $vmwarever_real - rhel${lsbmajdistrelease} ${yum_basearch}",
            enabled  => 1,
            gpgcheck => 1,
            gpgkey   => "http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub",
            baseurl  => "http://packages.vmware.com/tools/esx/${vmwarever_real}/rhel\$releasever/\$basearch/",
            priority => 10,
            protect  => 0,
           #require  => [ Package["yum-priorities"], Package["yum-protectbase"], ],
          }
        }
        #suse, opensuse, sles: {
        /(?i:suse|opensuse|sles)/: {

          exec { "signdsakey":
           command => "rpm --import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub",
           path => "/bin:/usr/bin",
           refreshonly => true,
          }
          exec { "signrsakey":
           command => "rpm --import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub",
           path => "/bin:/usr/bin",
           refreshonly => true,
          }

          $str = "[vmware-tool]
            name=VMware Tools $vmwarever_real - sles${lsbmajdistrelease} ${architecture}
            baseurl=http://packages.vmware.com/tools/esx/${vmwarever_real}/sles\$releasever/$zypp_basearch
            enabled=1
            path=/
            type=rpm-md
            gpgcheck=1
            gpgkey=http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub
            "

          file { "/etc/zypp/repos.d/vmware-tools.repo":
          content => $str,
          require => [ Exec["signrsakey"], Exec["signdsakey"], ],
          }

#         package{ 'yum': ensure => present }
#          yumrepo { "vmware":
#            descr    => "VMware Tools $vmwarever_real - sles${lsbmajdistrelease} ${yum_basearch}",
#            enabled  => 1,
#            gpgcheck => 1,
#            gpgkey   => "http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub",
#            baseurl  => "http://packages.vmware.com/tools/esx/${vmwarever_real}/sles\$releasever/\$basearch/",
#            priority => 10,
#            protect  => 0,
#            require  => Package["yum"],
#          }
        }
        default: { fail "Unknown operating system $operatingsystem" }
      }

      service { "vmware-tools":
        name       => $operatingsystem ? {
          default => "vmware-tools",
        },
        ensure     => "running",
        enable     => "true",
        hasrestart => "true",
        hasstatus  => "true",
        require    => Package["vmware-tools"],
      }

    }
    default: { }

  }
#}
}