CORD-391 - cleaned up ansible to pass cleanly through ansible-lint

Change-Id: I90284704255edc19abbdb239852c520a4bf48df4
diff --git a/roles/ansible/tasks/main.yml b/roles/ansible/tasks/main.yml
index f97ecf8..19e285d 100644
--- a/roles/ansible/tasks/main.yml
+++ b/roles/ansible/tasks/main.yml
@@ -6,5 +6,5 @@
 - name: Ensure Ansible
   become: yes
   apt:
-    name=ansible
-    state=latest
+    name=ansible=2.1.1.*
+    state=present
diff --git a/roles/compute-node/tasks/i40e_driver.yml b/roles/compute-node/tasks/i40e_driver.yml
index 69c14cd..78bd3ef 100644
--- a/roles/compute-node/tasks/i40e_driver.yml
+++ b/roles/compute-node/tasks/i40e_driver.yml
@@ -21,6 +21,7 @@
   command: make install
   args:
     chdir: i40e-1.4.25/src
+  changed_when: true
 
 - name: Load i40e Driver
   become: yes
diff --git a/roles/compute-node/tasks/main.yml b/roles/compute-node/tasks/main.yml
index f74ab55..ebbb1be 100644
--- a/roles/compute-node/tasks/main.yml
+++ b/roles/compute-node/tasks/main.yml
@@ -9,17 +9,17 @@
 
 - name: Applications
   become: yes
-  apt: name={{ item }} state=latest force=yes
+  apt: name={{ item }} state=present force=yes
   with_items:
-    - build-essential
-    - git
-    - python-pip
-    - ifenslave-2.6
-    - bridge-utils
-    - ethtool
-    - minicom
-    - curl
-    - jq
+    - build-essential=11.6*
+    - git=1:1.9.*
+    - python-pip=1.5.4*
+    - ifenslave-2.6=2.4*
+    - bridge-utils=1.5-*
+    - ethtool=1:3.13*
+    - minicom=2.7*
+    - curl=7.35.*
+    - jq=1.4*
 
 - name: Ensure Docker Insecure Repository
   become: yes
@@ -139,13 +139,13 @@
     - interface_config
 
 - name: Update mlx4 Driver
-  include: tasks/mlx4_driver.yml
+  include: mlx4_driver.yml
   when: mlx_nic_present.stdout != "0" and mlx4_version.stdout != '3.1-1.0.4'
   tags:
     - interface_config
 
 - name: Update i40e Driver
-  include: tasks/i40e_driver.yml
+  include: i40e_driver.yml
   when: intel_nic_present.stdout != "0" and i40e_version.stdout != '1.4.25'
   tags:
     - interface_config
diff --git a/roles/compute-node/tasks/mlx4_driver.yml b/roles/compute-node/tasks/mlx4_driver.yml
index 06219d2..a9b76f0 100644
--- a/roles/compute-node/tasks/mlx4_driver.yml
+++ b/roles/compute-node/tasks/mlx4_driver.yml
@@ -17,6 +17,7 @@
 - name: Install mlx4 driver
   become: yes
   command: /tmp/mlnx-en-3.1-1.0.4/install.sh --batch
+  changed_when: true
 
 - name: Remove Build Directory
   become: yes
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index cd609fa..644bd80 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -1,9 +1,9 @@
 - name: Apt Information
   become: yes
-  apt: name={{ item }} state=latest force=yes
+  apt: name={{ item }} state=present force=yes
   with_items:
-    - apt-transport-https
-    - ca-certificates
+    - apt-transport-https=1.0*
+    - ca-certificates=20160104*
 
 - name: Docker Apt Key
   become: yes
@@ -21,8 +21,8 @@
 - name: Docker Engine
   become: yes
   apt:
-    name: docker-engine
-    state: latest
+    name: docker-engine=1.12*
+    state: present
     force: yes
 
 - name: Docker Exposed via TCP
diff --git a/roles/fabric-switch/tasks/main.yml b/roles/fabric-switch/tasks/main.yml
index 41251e7..e9e2873 100644
--- a/roles/fabric-switch/tasks/main.yml
+++ b/roles/fabric-switch/tasks/main.yml
@@ -15,7 +15,7 @@
   changed_when: false
 
 - name: Openflow Agent Version
-  shell: ofdpa --version
+  command: ofdpa --version
   register: ofdpa_version
   changed_when: false
   when: ofdpa_exists.stdout != "0"
diff --git a/roles/fabric-switch/tasks/ofdpa.yml b/roles/fabric-switch/tasks/ofdpa.yml
index 21af257..c1c0b37 100644
--- a/roles/fabric-switch/tasks/ofdpa.yml
+++ b/roles/fabric-switch/tasks/ofdpa.yml
@@ -39,7 +39,9 @@
 
 - name: Mark Persist Openflow Agent
   command: persist /etc/accton/ofdpa.conf
+  changed_when: true
 
 - name: Persist Openflow Agent
   command: savepersist
   failed_when: false
+  changed_when: true
diff --git a/roles/head-node/files/compute-node.yml b/roles/head-node/files/compute-node.yml
index ba2bd24..b8eb496 100644
--- a/roles/head-node/files/compute-node.yml
+++ b/roles/head-node/files/compute-node.yml
@@ -3,7 +3,8 @@
   hosts: all
   remote_user: ubuntu
   tasks:
-  - include_vars: vars/compute-node.yml
+  - name: Include variables
+    include_vars: vars/compute-node.yml
 
 - name: Configure compute hosts to use DNS server
   hosts: all
diff --git a/roles/head-node/files/connect-switch.yml b/roles/head-node/files/connect-switch.yml
index da4edb0..5fdb996 100644
--- a/roles/head-node/files/connect-switch.yml
+++ b/roles/head-node/files/connect-switch.yml
@@ -5,6 +5,7 @@
     - name: Lookup DHCP harvest
       shell: cat /etc/bind/maas/dhcp_harvest.inc | grep -i " cc:37:ab\| 70:72;cf" | awk '{print $1}'
       register: switches
+      changed_when: false
     - name: Add hosts into inventory
       add_host: name={{item}} group=fabric
       with_items: "{{switches.stdout_lines}}"
@@ -24,9 +25,11 @@
 
     - name: Purge hardware tables
       command: /root/purge
+      changed_when: true
 
     - name: Start indigo agent
       command: /root/connect -bg
+      changed_when: true
 
     - name: Verify indigo agent has been started
       command: ps aux
diff --git a/roles/maas/tasks/download.yml b/roles/maas/tasks/download.yml
index d5b2243..1fc73c7 100644
--- a/roles/maas/tasks/download.yml
+++ b/roles/maas/tasks/download.yml
@@ -7,8 +7,10 @@
 - name: Get Remote Size
   shell: curl -sSL -I "{{ item.url }}" | grep Content-Length | tail -1 | cut "-d " -f2
   register: remote_size
+  changed_when: false
   tags:
     - switch_support
+    - skip_ansible_lint
 
 - name: Check Local File
   stat:
@@ -23,6 +25,7 @@
   when: local_size.stat.exists == false or remote_size.stdout|int != local_size.stat.size
   tags:
     - switch_support
+    - skip_ansible_lint
 
 - name: Switch Boot Resources Permissions
   become: yes
diff --git a/roles/maas/tasks/main.yml b/roles/maas/tasks/main.yml
index 7b9089e..be2600f 100644
--- a/roles/maas/tasks/main.yml
+++ b/roles/maas/tasks/main.yml
@@ -6,26 +6,27 @@
   failed_when: false
   changed_when: false
 
-- fail: msg="The head node must have a network bridge named 'mgmtbr' to continue the deployment. Please see docuemataiton at 'http://github.com/opencord/cord`."
+- name: Verify Management Bridge
+  fail: msg="The head node must have a network bridge named 'mgmtbr' to continue the deployment. Please see docuemataiton at 'http://github.com/opencord/cord`."
   when: have_mgmtbr.rc != 0
 
 - name: Install Prerequisites
   become: yes
-  apt: name={{ item }} state=latest force=true
+  apt: name={{ item }} state=present force=true
   with_items:
-    - git
-    - bridge-utils
-    - curl
-    - python-pycurl
-    - python-pip
-    - ethtool
-    - jq
+    - git=1:1.9.*
+    - bridge-utils=1.5-*
+    - curl=7.35.*
+    - python-pycurl=7.19.*
+    - python-pip=1.5.4*
+    - ethtool=1:3.13*
+    - jq=1.4*
 
 - name: Install Python Prerequisites
   become: yes
-  pip: name={{ item }} state=latest
+  pip: name={{ item.name }} version={{ item.version }} state=present
   with_items:
-    - docker-py
+    - { name: "docker-py", version: "1.9.*" }
 
 - name: Stop Containers
   become: yes
@@ -304,6 +305,7 @@
 - name: Ensure Boot Resource Import Started
   become: yes
   shell: maas login cord http://localhost/MAAS/api/1.0/ "{{apikey.stdout}}" && maas cord boot-resources import && maas logout cord
+  changed_when: true
 
 - name: Ensure VirtualBox Power Management
   include: virtualbox.yml
@@ -320,6 +322,7 @@
 - name: Ensure SSH keys for Ansible
   become: yes
   command: cp {{ ansible_env['PWD'] }}/.ssh/id_rsa /etc/maas/ansible/id_rsa
+  changed_when: true
 
 - name: Ensure SSH Key Permissions
   become: yes
@@ -371,6 +374,7 @@
   with_items:
     - automation-compose.yml
     - harvest-compose.yml
+  changed_when: true
 
 - name: Wait For Image Download
   shell: maas login cord http://localhost/MAAS/api/1.0/ "{{apikey.stdout}}" > /dev/null 2>&1 && maas cord boot-resources read | jq 'map(select(.type != "Synced"))' && maas  logout  cord > /dev/null 2>&1
@@ -379,3 +383,4 @@
   retries: 5
   delay: 60
   failed_when: images_synced.stdout != "[]"
+  changed_when: false
diff --git a/roles/maas/tasks/virtualbox.yml b/roles/maas/tasks/virtualbox.yml
index 88dcba7..6d3c03f 100644
--- a/roles/maas/tasks/virtualbox.yml
+++ b/roles/maas/tasks/virtualbox.yml
@@ -1,9 +1,9 @@
 - name: VirtualBox Power Support
   become: yes
-  apt: name={{ item }} state=latest
+  apt: name={{ item }} state=present
   with_items:
-    - amtterm
-    - wsmancli
+    - amtterm=1.4*
+    - wsmancli=2.3.*
 
 - name: VirtualBox Power Script
   become: yes
diff --git a/roles/onos-fabric/tasks/main.yml b/roles/onos-fabric/tasks/main.yml
index 74b07e8..d633104 100644
--- a/roles/onos-fabric/tasks/main.yml
+++ b/roles/onos-fabric/tasks/main.yml
@@ -42,4 +42,3 @@
     owner={{ ansible_user }}
     group={{ ansible_user }}
     mode=0644
-    
diff --git a/roles/onos-fabric/vars/main.yml b/roles/onos-fabric/vars/main.yml
index 457d453..bb35dae 100644
--- a/roles/onos-fabric/vars/main.yml
+++ b/roles/onos-fabric/vars/main.yml
@@ -16,5 +16,3 @@
       location:
         leaf: 1
         port: 1
-  
-  
diff --git a/roles/registry/tasks/main.yml b/roles/registry/tasks/main.yml
index e371463..a55ecad 100644
--- a/roles/registry/tasks/main.yml
+++ b/roles/registry/tasks/main.yml
@@ -50,4 +50,5 @@
   command: docker-compose -f /etc/maas/{{ item }} up -d
   with_items:
     - registry-compose.yml
+  changed_when: true
   tags: [registry]