first update the hosts file to speed up the installation 25/3025/6
authorbaigk <baiguoku@huawei.com>
Wed, 4 Nov 2015 01:56:18 +0000 (17:56 -0800)
committerbaigk <baiguoku@huawei.com>
Fri, 13 Nov 2015 16:52:46 +0000 (16:52 +0000)
JIRA: COMPASS-135

Change-Id: I364d43b999896c7cccb5222a166588d86463e50c
Signed-off-by: baigk <baiguoku@huawei.com>
deploy/adapters/ansible/roles/common/tasks/main.yml

index 0b72d6e..04a18a8 100644 (file)
@@ -1,20 +1,12 @@
 ---
 - include_vars: "{{ ansible_os_family }}.yml"
 
-- name: first update pkgs
-  shell: "{{ ansible_pkg_mgr }}  update"
-
-- name: install packages
-  action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest"
-  with_items: packages | union(packages_noarch)
+- name: speed up ansible by purging landscape-common
+  apt: pkg=landscape-common state=absent purge=yes
+  when: ansible_os_family == "Debian"
 
 - name: update hosts files to all hosts
-  template: src=hosts
-            dest=/etc/hosts
-            backup=yes
-
-- name: make config template dir exist
-  file: path=/opt/os_templates state=directory mode=0755
+  template: src=hosts dest=/etc/hosts backup=yes
 
 - name: get compass-core hostname
   local_action: shell hostname
 
 - name: get compass-core addr
   shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
-  register: ip
+  register: COMPASS_SERVER
 
 - name: update compass-core name and ip to hosts files
   shell: |
     echo "# compass" >> /etc/hosts
-    echo {{ ip.stdout_lines[0] }} {{ name.stdout_lines[0] }} >> /etc/hosts
+    echo {{ COMPASS_SERVER.stdout_lines[0] }} {{ name.stdout_lines[0] }} >> /etc/hosts
+
+- name: first update pkgs
+  shell: "{{ ansible_pkg_mgr }}  update"
+
+- name: install packages
+  action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest"
+  with_items: packages | union(packages_noarch)
+
+- name: make config template dir exist
+  file: path=/opt/os_templates state=directory mode=0755
 
 - name: create pip config directory
   file: path=~/.pip state=directory
 
-- name: get pip source server addr
-  shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
-  register: COMPASS_SERVER
-
 - name: update pip.conf
   template: src=pip.conf dest=~/.pip/pip.conf