Destination directory /var/www/ansible does not exist

In your topology, i’ am using two web servers, one load balancer, one database server, and the controller,
i have the following error:

fatal: [web1]: FAILED! => {“changed”: false, “checksum”: “7554a0a3dd2af0c29c3819db80d7782bed390fed”, “msg”: “Destination directory /var/www/ansible does not exist”}
fatal: [web2]: FAILED! => {“changed”: false, “checksum”: “7554a0a3dd2af0c29c3819db80d7782bed390fed”, “msg”: “Destination directory /var/www/ansible does not exist”}

I checked /var/www/ansible , and it does exist. I even added a condition in my playbook to create it if it doesn’t exist. However, it’s still not working. I’m using the user ‘yoda’ instead of ‘vagrant’, and I’m concerned that I might not have the privileges to write to the file. When I try to manually modify it via ‘web1’ or ‘web2’, it works successfully. But right after I run my playbook, the permissions revert to default, and I can’t execute the command ls -Z /var/www/ansible via ‘web1’ or ‘web2’. Do you know what the issue might be? When I execute curl lb/db.php , I receive a 503 service unavailable error message."

Hard to tell without seeing the playbook, but are you using become and maybe become_user?

1 Like