Puppet Create Symlinks - task failed

Hi all,

Could you please tell me what’s wrong with this :

class symlink {
file { ‘/var/www/html’:
ensure => ‘link’,
target => ‘/opt/finance’,
force => yes
}
file { ‘/opt/finance/media.txt’:
ensure => ‘present’,
}
}

The reported error is as follow :

  • it seems like you haven’t create symbolic link through puppet programming code to ‘/var/www/html’ properly on App Server 1

Oh… you did a mistake. In Your code, you created symlink to /opt/finance, but in the output it seems you did it as /opt/devops!!

Hi @Devops,

Thanks for you reply. Sorry I shared the wrong code, the one from my first attempt. The correct one is :

image

@Inderpreet could you check please.

You did a mistake in your code.
The code should be as below:

file { ‘/opt/devops’:
ensure => ‘link’,
target => ‘/var/www/html’,
}

file { ‘/opt/devops/media.txt’:
ensure => ‘present’,
}

1 Like

On one hand, if we translate this question

image

into a command line we get this :

ln -s /opt/devops /var/www/html ( ln [options] source [dest])

On the other hand we have :

symlink syntax example

file { ‘/tmp/link-to-motd’:
ensure => ‘link’,
target => ‘/etc/motd’,
}

–> so for me all seems good :roll_eyes: I’m just trying to understand and perhaps learn from mistakes :wink: