I have completed my ansible+vagrant integration which is here. Playbook installs everything i've instructed. does every file modification as instructed. But when i check on my local machine using http:localhost:8080
or http://127.0.0.1:8080
it never works for index.php file. It always downloads the file. So in order to get it working i've to login to vagrant box and hit below commands to server in order to serve php page.
sudo service nginx restart
sudo service php7.0-fpm restart
I already defined a handler for restarting service which is as below.
- name: "restart services"
service: >
name= "{{ item }}"
state=restarted
with_items:
- nginx
- php7.0-fpm
I have a task that takes application git clone. which is as below.
- name: Application git clone
git:
repo: https://github.com/shaileshsutar88/deploy.git
dest: /var/www/html
notify:
- restart services
I am not sure what I am doing wrong here or if I am missing anything. Otherwise I would like know more about ansible execution flow. When i check ansible execution with verbose, it says ok which means handlers are not running. I am wondering why it's not running handlers since I am calling it after git clone of my application.
RUNNING HANDLER [web : restart services] ***************************************
ok: [web] => (item=nginx) => {"changed": false, "failed": false, "item": "nginx", "name": "", "status": {}}
ok: [web] => (item=php7.0-fpm) => {"changed": false, "failed": false, "item": "php7.0-fpm", "name": "", "status": {}}