Question

how to start apache2 with ansible if server only allow to access it with a specific user account before you can restart a service?

how to use ansible to restart an apache2 server on ubuntu 20.04, if by remotely you can only access it with a specific user before you can login as root or do a sudo command to restart the apache2 or other services?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

You can add become: true to define that tasks should be executed with privilege escalation (sudo) by default.

Can you share your playbook here?

For more information I could also suggest this step-by-step tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-20-04

Best,

Bobby