0
votes

I have a playbook that creates a directory, creates content on index.html, and a link from /web_hosting to /var/www/html.

The directory is called /web_hosting the content is /web_hosting/index.html I do not want to change the httpd.conf default web directory to /web_hosting I just want to use a link.

After running the play when I curl the server I'm not seeing the content from the index.html file. Can someone help me with my play?


  • name: setup webserver and link to folder hosts: prod tasks:
    • name: create dir file: path: /web_hosting state: directory setype: httpd_sys_content_t mode: 0775
    • name: install yum: name: httpd state: present
    • name: configure service service: name: httpd state: started enabled: true
    • name: create content on index.html copy: dest: /web_hosting/index.html content: "hello from {{ansible_hostname}}"
    • name: create link file: src: /web_hosting dest: /var/www/html state: link
1
This has nothing to do with ansible but with your apache configuration: superuser.com/questions/244245/…Zeitounator

1 Answers

1
votes

This doesn't sound like an Ansible problem if it is creating the files and not erroring out.

If you manually create a file in /var/www/html/ called "index2.html", can you use curl to see it? If not, then it's definitely NOT an Ansible problem.

If that test works, then look for differences in ownership, SELinux permissions, etc. Then use Ansible to set those properly on your "index.html".

I suspect you might need to enable a "follow links" setting in your webserver configuration. But again, that's not an Ansible issue either - though Ansible could update the configuration file once you figure out what setting(s) to apply.