- # Set the user:group owners and mode of ODL dir
- file { '/opt/opendaylight/':
- # ensure=>dir and recurse=>true are required for managing recursively
- ensure => 'directory',
- recurse => true,
- # Set user:group owners of ODL dir
- owner => 'odl',
- group => 'odl',
- # The ODL archive we're modifying should exist
- # Since ODL's dir is owned by odl:odl, that user:group should exist
- require => [Archive['opendaylight'], Group['odl'], User['odl']],
- }
-
- # Systemd vs upstart config depends on OS family
- if ( $::osfamily == 'RedHat' ) {
- # Download ODL systemd .service file and put in right location
- archive { 'opendaylight-systemd':
- ensure => present,
- url => $opendaylight::unitfile_url,
- # Will end up installing /usr/lib/systemd/system/opendaylight.service
- target => '/usr/lib/systemd/system/',
- # Required by archive mod for correct exec `creates` param
- root_dir => 'opendaylight.service',
- # ODL doesn't provide a checksum in the expected path, would fail
- checksum => false,
- # This discards top-level dir of extracted tarball
- # Required to get proper /opt/opendaylight-<version> path
- strip_components => 1,
- # May end up with an HTML redirect output in a text file without this
- # Note that the curl'd down file would still have a .tar.gz name
- follow_redirects => true,
- # Should exist before we try to set its user/group/mode
- before => File['/usr/lib/systemd/system/opendaylight.service'],
- }
-
- # Set the user:group owners and mode of ODL's systemd .service file
- file { '/usr/lib/systemd/system/opendaylight.service':
- # It should be a normal file
- ensure => 'file',
- # Set user:group owners of ODL systemd .service file
- owner => 'root',
- group => 'root',
- # Set mode of ODL systemd .service file
- mode => '0644',
- # Should happen after the ODL systemd .service file has been extracted
- require => Archive['opendaylight-systemd'],
- }
- }
- elsif ( $::osfamily == 'Debian' ) {
- file { '/etc/init/opendaylight.conf':
- # It should be a normal file
- ensure => 'file',
- # Set user:group owners of ODL upstart file
- # NB: Unverfied, not sure if this is correct for upstart
- owner => 'root',
- group => 'root',
- # Set mode of ODL upstart file
- # NB: Unverfied, not sure if this is correct for upstart
- mode => '0644',
- # Use Puppet URL for Travis. File stored in opendaylight/files/
- content => 'puppet:///modules/opendaylight/upstart.odl.conf'
- }
- }
- else {
- fail("Unsupported OS family: ${::osfamily}")
- }
- }
- else {
- fail("Unknown install method: ${opendaylight::install_method}")