inimene
inimene

Reputation: 1650

Creating symbolic link with programmatic name

How would one create symbolic links in Ansible with programmatic names?

I need this for LDAP. Command I usually run is this:

ln -s /etc/openldap/cacerts/mycert.pem /etc/openldap/cacerts/`openssl x509 -noout -hash -in /etc/openldap/cacerts/mycert.pem`.0

The command module does not accept such command, it will say

"stderr": "ln: invalid option -- 'o'\nTry 'ln --help' for more information."

And the file module which is meant for this does not seem to support adding some shell commands at all. What could be done in Ansible to solve such problem?

Upvotes: 0

Views: 568

Answers (1)

gile
gile

Reputation: 5976

Try using shell module:

shell: ln -s /etc/openldap/cacerts/mycert.pem /etc/openldap/cacerts/`openssl x509 -noout -hash -in /etc/openldap/cacerts/mycert.pem`.0

Upvotes: 1

Related Questions