ERROR: /etc/nginx/conf.d does not exist


After updating my (Ubuntu 22.04) server, I suddenly get the following error when running the ansible-playbook galaxy.yml command:

TASK [galaxyproject.nginx : Set additional config options] ***********************************************************************************************************
fatal: []: FAILED! => changed=false
  checksum: 3cb6cfac4f721ecabef8f03be6774942e82eeb0f
  msg: Destination directory /etc/nginx/conf.d does not exist

I never got this error before the update. After checking the /etc/nginx directory, I found out that the directory was completely gone. I ran the ansible-galaxy install requirements.yml command again just in case, but this ofcourse didn’t change anything. I am stuck not knowing where to go from here. Any help is appreciated!

The error was ultimately fixed by running the following commands as root (sudo su):

apt-get purge nginx nginx-common nginx-full

Followed by:

ansible-galaxy install requirements.yml

And finally:

apt-get install nginx

It is still unknown what caused the error, but this is what fixed it.

Just curious and it may help others. Have you also tried to remove nginx ( apt-get purge nginx nginx-common nginx-full) and after that re-run ansible-galaxy install requirements.yml?

Yes, but that unfortunately didn’t change anything for me, the etc/nginx/ directory was still missing after running the command. The command that ultimately installed nginx again was the command I mentioned in the solution post.

Edit: A combination of both the commands might have been the actual solution, I will change the solution above. Thank you!