Report this

What is the reason for this report?

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

Posted on March 30, 2022

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?



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!

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.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.