0

Unable to form a link of a file which is in sites-available to a directory sites-enabled in remote server using ansible?

This is command I want to execute using file module of ansible: ln -s /etc/apache2/sites-available/wsgi-keystone.conf /etc/apache2/ sites-enabled

This is the code of the task i am using:

- name: Enable the Identity service virtual hosts
  file: src=/etc/apache2/sites-available/wsgi-keystone.conf dest=/etc/apache2/sites-enabled state=link owner=root group=root mode=0644

By the way I am running the playbook as root user:

Getting the following error:

fatal: [10.0.1.32]: FAILED! => {"changed": false, "failed": true, "gid": 0, "group": "root", "mode": "0755", "msg": "refusing to convert between directory and link for /etc/apache2/sites-enabled", "owner": "root", "path": "/etc/apache2/sites-enabled", "size": 4096, "state": "directory", "uid": 0}
Karthik Vee
  • 35
  • 1
  • 1
  • 5

1 Answers1

0

You're trying to set a link on /etc/apache2/sites-enabled which is obviously a directory.

You have to define a full qualified filename:

- name: Enable the Identity service virtual hosts
  file: src=/etc/apache2/sites-available/wsgi-keystone.conf dest=/etc/apache2/sites-enabled/wsgi-keystone.conf state=link owner=root group=root mode=0644
flxPeters
  • 499
  • 4
  • 5