You need to be root to perform this command.

hi,I have been trying to run this playbook.

  • hosts: webservers

vars:

http_port: 80

max_clients: 200

remote_user: root

tasks:

  • name: ensure apache is at the latest version

yum: name=httpd state=latest

  • name: write the apache config file

template: src=/srv/httpd.j2 dest=/etc/httpd.conf

notify:

  • restart apache

  • name: ensure apache is running (and enable it at boot)

service: name=httpd state=started enabled=yes

handlers:

  • name: restart apache

service: name=httpd state=restarted

You need a space after the colon, and
sudo: is deprecated so use become: yes

ok. Thank you .