Logs added with msgs 98/3498/2
authorArvind Patel <arvind.patel@huawei.com>
Thu, 21 May 2020 16:29:13 +0000 (21:59 +0530)
committerArvind Patel <arvind.patel@huawei.com>
Thu, 21 May 2020 16:44:34 +0000 (22:14 +0530)
Change-Id: I6f9d179c74b63a917a423e538678a5110cc12a34

14 files changed:
ocd/infra/playbooks/roles/docker/tasks/install.yml
ocd/infra/playbooks/roles/docker/tasks/main.yml
ocd/infra/playbooks/roles/docker/tasks/uninstall.yml
ocd/infra/playbooks/roles/grafana/tasks/install.yml
ocd/infra/playbooks/roles/grafana/tasks/uninstall.yml
ocd/infra/playbooks/roles/helm/tasks/install.yml
ocd/infra/playbooks/roles/helm/tasks/uninstall.yml
ocd/infra/playbooks/roles/k3s/tasks/install.yml
ocd/infra/playbooks/roles/k3s/tasks/uninstall.yml
ocd/infra/playbooks/roles/k8s/tasks/install.yml
ocd/infra/playbooks/roles/prometheus/tasks/install.yml
ocd/infra/playbooks/roles/prometheus/tasks/uninstall.yml
ocd/infra/playbooks/roles/rabbitmq/tasks/install.yml
ocd/infra/playbooks/roles/rabbitmq/tasks/uninstall.yml

index f474369..e411e16 100644 (file)
 
 - debug:
     msg: Docker is already present
-  when: result.rc == 0
+  when: result.stdout != ""
+
+- debug:
+# yamllint disable rule:line-length
+    msg: Ignore Uninstall Log , Docker not installed continue with Installation
+# yamllint disable rule:line-length
+  when: result.stdout == ""
 
 - name: "Installing docker update"
   command: apt-get update -y
   command: apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
 # yamllint disable rule:line-length
   ignore_errors: yes
+  when: result is failed and ansible_architecture == 'aarch64'
 
 - name: Add repository
   shell: curl -sL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+  when: result is failed and ansible_architecture == 'aarch64'
 
 - name: "CA-Certificates"
 # yamllint disable rule:line-length
   ignore_errors: yes
   failed_when: false
   no_log: True
+  when: result is failed and ansible_architecture == 'aarch64'
 
 - name: "Update....."
   command: apt-get update -y
   ignore_errors: yes
   failed_when: false
   no_log: True
+  when: result is failed and ansible_architecture == 'aarch64'
 
 - name: "Installed docker"
   command: apt-get install -y docker-ce docker-ce-cli containerd.io
   ignore_errors: yes
+  when: result is failed and ansible_architecture == 'aarch64'
index 39f13a2..4c99ef0 100644 (file)
 
 ---
 # tasks file for docker
-- name: Helm install
-  debug:
-    msg: installing helm
-
 - include: "install.yml"
   when: operation == 'install'
 
index a28fcdb..d011d18 100644 (file)
 
 ---
 - name: Check whether docker is installed before deleting
-  command: docker version
+  command: which docker
   register: result
   ignore_errors: yes
   no_log: True
 
 - debug:
-    msg: Docker is not present
-  when: result.rc == 2
+    msg: Uninstalling docker...
+  when: result.stdout != ""
+
+- debug:
+# yamllint disable rule:line-length
+    msg: Ignore Uninstall Log , Docker not installed
+# yamllint disable rule:line-length
+  when: result.stdout == ""
 
 - name: "Uninstall docker engine"
   command: apt-get purge -y docker-engine
   ignore_errors: yes
+  when: result is succeeded and ansible_architecture == 'aarch64'
 
 - name: "Uninstall docker"
   command: apt-get purge -y docker
   ignore_errors: yes
+  when: result is succeeded and ansible_architecture == 'aarch64'
   #when: result is succeeded and ansible_architecture == 'x86_64'
 
 - name: "Uninstall docker.io"
   command: apt-get purge -y docker.io
   ignore_errors: yes
-  #when: result is succeeded and ansible_architecture == 'aarch64'
+  when: result is succeeded and ansible_architecture == 'aarch64'
 
 - name: "Uninstall docker-ce"
   command: apt-get purge -y docker-ce
   ignore_errors: yes
+  when: result is succeeded and ansible_architecture == 'aarch64'
   #when: result is succeeded and ansible_architecture == 'aarch64'
 
 - name: "Uninstall docker"
   command: apt-get purge -y docker-ce-cli
   ignore_errors: yes
+  when: result is succeeded and ansible_architecture == 'aarch64'
   #when: result is succeeded
index bdf2854..e55bda8 100644 (file)
   no_log: True
 
 - debug:
-    msg: Grafana is already present
-  when: result.rc == 0
+    msg: grafana is already present
+  when: result.stdout != ""
+
+- debug:
+# yamllint disable rule:line-length
+    msg: Ignore Uninstall Log , Grafana not installed continue with Installation
+# yamllint disable rule:line-length
+  when: result.stdout == ""
 
 - name: Install grafana on x86_64
   shell:
index aaad4ea..6f08c57 100644 (file)
   no_log: True
 
 - debug:
-    msg: grafana is not present
-  when: result.rc == 2
+    msg: Uninstalling docker...
+  when: result.stdout != ""
+
+- debug:
+    msg: Ignore Uninstall Log , Grafana not installed
+  when: result.stdout == ""
 
 - name: Uninstall grafana
   shell:
index e0f33d9..5dc8a0c 100644 (file)
   no_log: True
 
 - debug:
-    msg: Helm is already present
-  when: result.rc == 0
+    msg: helm is already present
+  when: result.stdout != ""
+
+- debug:
+# yamllint disable rule:line-length
+    msg: Ignore Uninstall Log , Helm not installed continue with Installation
+# yamllint disable rule:line-length
+  when: result.stdout == ""
 
 - name: "Helm download command on x86_64"
   command: wget https://get.helm.sh/helm-v3.0.2-linux-amd64.tar.gz
index 09aa6b2..1b18e36 100644 (file)
   no_log: True
 
 - debug:
-   msg: Helm is not present
-  when: result.rc == 2
+    msg: Uninstalling helm...
+  when: result.stdout != ""
+
+- debug:
+    msg: Ignore Uninstall Log ,Helm not installed
+  when: result.stdout == ""
 
 - name: Helm Uninstall on x86_64
   command: rm -rf linux-amd64/helm
index c9f09c9..0aaa7bd 100644 (file)
 
 - debug:
     msg: k3s is already present
-  when: result.rc == 0
+  when: result.stdout != ""
+
+- debug:
+# yamllint disable rule:line-length
+    msg: Ignore Uninstall Log , k3s not installed continue with Installation
+# yamllint disable rule:line-length
+  when: result.stdout == ""
 
 - debug: var=ansible_host
 
index e2232d5..bbf013c 100644 (file)
   no_log: True
 
 - debug:
-    msg: k3s is not present
-  when: result.rc == 2
+    msg: Uninstalling k3s...
+  when: result.stdout != ""
+
+- debug:
+    msg: Ignore Uninstall Log , K3s not installed
+  when: result.stdout == ""
 
 - name: kill k3s
   shell:
index 2b32b6d..cd55ebf 100644 (file)
 
 - debug:
     msg: k8s is already present
-  when: result.rc == 0
+  when: result.stdout != ""
+
+- debug:
+# yamllint disable rule:line-length
+    msg: Ignore Uninstall Log , k8s not installed continue with Installation
+# yamllint disable rule:line-length
+  when: result.stdout == ""
 
 - name: Install k8s
   shell:
index 0c85ecf..be458fd 100644 (file)
   no_log: True
 
 - debug:
-    msg: Prpmetheus is already present
-  when: result.rc == 0
+    msg: prometheus is already present
+  when: result.stdout != ""
+
+- debug:
+# yamllint disable rule:line-length
+    msg: Ignore Uninstall Log , prometheus not installed continue with Installation
+# yamllint disable rule:line-length
+  when: result.stdout == ""
 
 - name: Install prometheus on x86_64
   shell:
index d9a1f4e..c6436c5 100644 (file)
   no_log: True
 
 - debug:
-    msg: Prometheus is not present
-  when: result.rc == 2
+    msg: Uninstalling prometheus...
+  when: result.stdout != ""
+
+- debug:
+    msg: Ignore Uninstall Log , Prometheus not installed
+  when: result.stdout == ""
 
 - name: Uninstall prometheus
   shell:
index f3e433c..d6fe987 100644 (file)
   no_log: True
 
 - debug:
-    msg: Rabbitmq is already present
-  when: result.rc == 0
+    msg: rabbitmq is already present
+  when: result.stdout != ""
+
+- debug:
+# yamllint disable rule:line-length
+    msg: Ignore Uninstall Log , rabbitmq not installed continue with Installation
+# yamllint disable rule:line-length
+  when: result.stdout == ""
 
 - name: copy common folder to host for rabbitmg installation
   copy:
index e404819..14c1276 100644 (file)
   no_log: True
 
 - debug:
-    msg: Rabbitmq is not present
-  when: result.rc == 2
+    msg: Uninstalling rabbitmq...
+  when: result.stdout != ""
+
+- debug:
+    msg: Ignore Uninstall Log , Rabbitmq not installed
+  when: result.stdout == ""
 
 - name: Uninstalling rabbitmq
   shell: