cancel
Showing results for 
Search instead for 
Did you mean: 
spurs
Flight Engineer
Flight Engineer
  • 207 Views

Symlink using file module

Jump to solution

Hello guys,

I was working on the lab and understood this question.

-Use the file module to ensure that /etc/issue.net is a symbolic link to /etc/issue on the managed host.

So basically, /etc/issue.net >> /etc/issue.

However, I'm so confused what is the src and what is the dest.

I feel like issue.net is going to the issue, so issue should be the dest.

 

Here is the right code

   - name: Ensure /etc/issue.net is a symlink to /etc/issue
      file:
        src: /etc/issue
        dest: /etc/issue.net
        state: link
        owner: root
        group: root
        force: yes


Is there any easier way to understand src and dest regarding the symlink?

 

Thanks

Labels (1)
1 Solution

Accepted Solutions
Chetan_Tiwary_
Moderator
Moderator
  • 199 Views

Symlinks act as shortcuts with advanced properties that allow access to files from locations other than their original place in the folder hierarchy by providing operating systems with instructions on where the “target” file can be found.

 

ln [-fs] [-L|-P] source_file target_file

ln
 [-fs] [-L|-P] source_file... target_dir

https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/ln.html 

 ln [OPTION]... [-T] TARGET LINK_NAME
       ln [OPTION]... TARGET
       ln [OPTION]... TARGET... DIRECTORY
       ln [OPTION]... -t DIRECTORY TARGET...

https://www.man7.org/linux/man-pages/man1/ln.1.html 

View solution in original post

0 Kudos
2 Replies
Chetan_Tiwary_
Moderator
Moderator
  • 200 Views

Symlinks act as shortcuts with advanced properties that allow access to files from locations other than their original place in the folder hierarchy by providing operating systems with instructions on where the “target” file can be found.

 

ln [-fs] [-L|-P] source_file target_file

ln
 [-fs] [-L|-P] source_file... target_dir

https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/ln.html 

 ln [OPTION]... [-T] TARGET LINK_NAME
       ln [OPTION]... TARGET
       ln [OPTION]... TARGET... DIRECTORY
       ln [OPTION]... -t DIRECTORY TARGET...

https://www.man7.org/linux/man-pages/man1/ln.1.html 

0 Kudos
Chetan_Tiwary_
Moderator
Moderator
  • 194 Views

Also a better analogy to remember is : 

 ln -s existing_entity new_entity

or 

 ln -s old new

 

0 Kudos
Join the discussion
You must log in to join this conversation.