P.S.
Im sorry for "spamming", I have just tried the handler with sudo_user
option to check if Ansible will call it. You cannot restart nginx as non
root user.
On Monday, March 24, 2014 4:07:42 PM UTC+1, Marko Lisica wrote:
>
> Hello,
>
> Have you just tried? : D .
>
> I have tried it like this
>
> - name: restart nginx
> service: name=nginx state=restarted
> sudo_user: username
>
> But have in mind that user must have permissions for the service.
>
>
> On Sunday, March 23, 2014 6:00:20 PM UTC+1, Wei Yen Lee wrote:
>>
>> Hi,
>>
>> Long-time lurker, first time poster. First off, thanks for this excellent
>> project.
>>
>> I'd like to know, is it possible to run the 'notify' handler as a
>> different user from the task which notified it? E.g.
>>
>> ---
>> # deploy.yml
>> - hosts: webservers
>> remote_user: project_user
>> roles:
>> - webapp
>>
>> ---
>> # webapp/tasks/main.yml
>> # This should be run as project_user
>> - name: Pull sources from the repository.
>> git: repo={{project_repo}}
>> dest={{project_root}}
>> version={{branch}}
>> notify:
>> - Restart supervisord
>>
>> ---
>> # webapp/handler/main.yml
>> # This should be run as root
>> - name: Restart supervisord
>> supervisorctl: name={{ item }}
>> state=restarted
>> with_items:
>> - celeryd
>> - celerybeat
>>
>>
>>
>> If it's not possible, what's the best way to structure the project?
>>
>> Thanks in advance!
>>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/769c4813-076e-49d4-b34b-672bad1326b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.