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
Answer a question...

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.

Bobby Iliev
Site Moderator
Site Moderator badge
March 30, 2022

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