Playbook file cleanup to improve the synchronizer execution time
Also removed synchronization of sFlow models as sFlow service is not fully supported yet

Change-Id: I3fd4cc105c62e2996a3e74792fe078f812fef0aa
diff --git a/xos/synchronizer/manifest b/xos/synchronizer/manifest
index f002ef4..d261657 100644
--- a/xos/synchronizer/manifest
+++ b/xos/synchronizer/manifest
@@ -21,12 +21,8 @@
 manifest
 run.sh
 monitoring_synchronizer_config
-steps/sync_sflowtenant.yaml
-steps/sync_sflowtenant.py
 steps/sync_monitoringchannel.yaml
 steps/sync_monitoringchannel.py
-steps/sync_sflowservice.yaml
-steps/sync_sflowservice.py
 steps/sync_ceilometerservice.yaml
 steps/sync_ceilometerservice.py
 steps/sync_openstackmonitoringpublisher.py
diff --git a/xos/synchronizer/steps/sync_monitoringchannel.yaml b/xos/synchronizer/steps/sync_monitoringchannel.yaml
index b366184..d6571ea 100644
--- a/xos/synchronizer/steps/sync_monitoringchannel.yaml
+++ b/xos/synchronizer/steps/sync_monitoringchannel.yaml
@@ -3,7 +3,6 @@
 #  gather_facts: False
   connection: ssh
   user: ubuntu
-  sudo: yes
   vars:
       unique_id: {{ unique_id }}
       auth_url: {{ auth_url }}
@@ -28,7 +27,6 @@
 # FIXME: Adding dummy template action to avoid "action attribute missing in task" error
     template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
     notify:
-     - stop monitoring-channel
      - remove container
 {% else %}
 {% if full_setup %}
@@ -37,111 +35,38 @@
       regexp='^127\.0\.0\.1'
       line="127.0.0.1 localhost {{ '{{' }} ansible_hostname {{ '}}' }}"
       owner=root group=root mode=0644
+    become: yes
 
   - name: Add user to docker group
     user: name=ubuntu group=docker append=yes
-
-#  - name: Docker repository
-#    copy: src=/opt/xos/synchronizers/monitoring/files/docker.list
-#      dest=/etc/apt/sources.list.d/docker.list
-#
-#  - name: Import the repository key
-#    apt_key: keyserver=keyserver.ubuntu.com id=36A1D7869245C8950F966E92D8576A8BA88D21E9
-#
-#  - name: install Docker
-#    apt: name=lxc-docker state=present update_cache=yes
-#
-#  - name: install python-setuptools
-#    apt: name=python-setuptools state=present
-#
-#  - name: install pip
-#    easy_install: name=pip
-#
-#  - name: install docker-py
-#    pip: name=docker-py version=0.5.3
-#
-#  - name: install Pipework
-#    get_url: url=https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework
-#       dest=/usr/local/bin/pipework
-#       mode=0755
-#
-#  - name: Disable resolvconf service
-#    shell: service resolvconf stop
-#    shell: echo manual > /etc/init/resolvconf.override
-#    shell: rm -f /etc/resolv.conf
-#
-#  - name: Install resolv.conf
-#    copy: src=/opt/xos/synchronizers/monitoring_channel/files/vm-resolv.conf
-#      dest=/etc/resolv.conf
+    become: yes
 {% endif %}
 
   - name: ceilometer proxy config
     template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
+    become: yes
     notify:
-     - copy ceilo-config-file
      - restart monitoring-channel container
      - set monitoring-channel-mtu
 
-  - name: Monitoring channel upstart
-    template: src=/opt/xos/synchronizers/monitoring/templates/monitoring-channel.conf.j2 dest=/etc/init/monitoring-channel-{{ unique_id }}.conf
-
-  - name: Monitoring channel startup script
-    template: src=/opt/xos/synchronizers/monitoring/templates/start-monitoring-channel.sh.j2 dest=/usr/local/sbin/start-monitoring-channel-{{ unique_id }}.sh mode=0755
-    notify:
-#    - restart monitoring-channel
-     - stop monitoring-channel
-     - remove container
-     - start monitoring-channel
-
-#  - name: Start monitoring-channel container
-#    docker:
-#      docker_api_version: "1.18"
-#      name: monitoring-channel-{{ unique_id }}
-#      # was: reloaded
-#      state: running
-#      image: srikanthvavila/monitoring-channel
-#      expose:
-#      - 8000
-#      ports:
-#      - "{{ ceilometer_port }}:8000"
-#      volumes:
-#      - /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config
-#
-#  - name: Get Docker IP
-#    #TODO: copy dockerip.sh to monitoring service synchronizer
-#    script: /opt/xos/synchronizers/onos/scripts/dockerip.sh monitoring-channel-{{ unique_id }}
-#    register: dockerip
-#
-#  - name: Wait for Monitoring channel to come up
-#    wait_for:
-#      host={{ '{{' }} dockerip.stdout {{ '}}' }}
-#      port={{ '{{' }} item {{ '}}' }}
-#      state=present
-#    with_items:
-#    - {{ ceilometer_port }}
-
-  - name: Make sure Monitoring channel service is running
-    service: name=monitoring-channel-{{ unique_id }} state=started
 {% endif %}
 
   handlers:
-  - name: copy ceilo-config-file
-    shell: docker cp /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config monitoring-channel-{{ unique_id }}:/usr/local/share/ceilometer_proxy_config
-
   - name: restart monitoring-channel container
-    shell: docker restart monitoring-channel-{{ unique_id }}
-
-  - name: restart monitoring-channel
-    shell: service monitoring-channel-{{ unique_id }} stop; sleep 1; service monitoring-channel-{{ unique_id }} start
-
-  - name: stop monitoring-channel
-    service: name=monitoring-channel-{{ unique_id }} state=stopped
+    docker:
+      docker_api_version: "1.18"
+      name: monitoring-channel-{{ unique_id }}
+      state: restarted
+      image: srikanthvavila/monitoring-channel
+      expose:
+      - 8000
+      ports:
+      - "{{ ceilometer_port }}:8000"
+      volumes:
+      - /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config
 
   - name: remove container
-    docker: name=monitoring-channel-{{ unique_id }} state=absent image=monitoring-channel
-
-  - name: start monitoring-channel
-    service: name=monitoring-channel-{{ unique_id }} state=started
+    docker: name=monitoring-channel-{{ unique_id }} state=absent image=srikanthvavila/monitoring-channel
 
   - name: set monitoring-channel-mtu
-    shell: docker exec monitoring-channel-{{ unique_id }} sudo ifconfig eth0 mtu 1450 up
+    shell: docker exec --privileged monitoring-channel-{{ unique_id }} sudo ifconfig eth0 mtu 1450 up