I'm trying code
- name: create a symlink
ansible.builtin.file:
src: /usr/share/easy-rsa/*
dest: ~/easy-rsa/
state: link
but getting err Error while replacing: [Errno 2] No such file or directory: b'/usr/share/easy-rsa/*'
Is it possible to create a symlink with ansible.builtin.file
using wildcard?
Is it possible to create a symlink with
ansible.builtin.file
using wildcard?
In short,
No. Symbolic link resolution is handled by the kernel whereas globbing is shell-specific.1
No, that is not how file systems work. A file system stores existing file names, not potential file names.2
If using shell
module with Bash you could do something like this.
The long answer would be to check the existence of directories and create the symlinks within a loop. For this a few tasks will be necessary.
Credits To
and many more ...