---
- hosts: "{{ hosts }}"
  become: yes
  tasks:
    - name: install rsync
      yum:
        name: rsync
        state: present
    - name: creates directory
      file:
        path: "/data/www/nginx-conf/{{ dest }}"
        state: directory
        owner: www
        group: www
        mode: 0775
    - name: sync config 
      synchronize:
        src: "{{ src }}/"
        dest: "/data/www/nginx-conf/{{ dest }}/"
        delete: yes
    - name: recursively change ownership of a directory
      file:
        path: /data/www/nginx-conf
        state: directory
        recurse: yes
        owner: www
        group: www
        mode: 0644
    - name: reloaded nginx
      shell: /etc/init.d/nginx reload
    - name: get ps
      shell: ps -ef|grep nginx|grep -v grep
      register: psInfo
    - name: show ps
      debug: msg="{{ psInfo }}"
