Parameterize arch with ansible_architecture 86/12286/16
authorJeremy Phelps <jphelps@linuxfoundation.org>
Thu, 16 Aug 2018 19:53:17 +0000 (14:53 -0500)
committerJeremy Phelps <jphelps@linuxfoundation.org>
Mon, 17 Sep 2018 20:41:29 +0000 (15:41 -0500)
Note that docker uses armhf instead of aarch64.

Change-Id: I70c1734f9435f44dda3a314141ac0c1675b2a544
Signed-off-by: Jeremy Phelps <jphelps@linuxfoundation.org>
tasks/main.yml

index dc87459..2aec7f7 100644 (file)
@@ -1,11 +1,22 @@
 ---
+- name: "Checking for x86_64"
+  set_fact:
+    host_arch: "amd64"
+  when: "'x86_64' in ansible_architecture"
+
+- name: "Checking for aarch64"
+  set_fact:
+    host_arch: "armhf"
+  when: "'aarch64' in ansible_architecture"
+
 - name: Install Docker (RedHat)
   block:
     - name: Install Docker requirements
-      yum: 'name={{item}} state=present'
-      with_items:
-        - device-mapper-persistent-data
-        - lvm2
+      yum:
+        name:
+          - device-mapper-persistent-data
+          - lvm2
+        state: present
     - name: Add Docker repository
       get_url:
         url: https://download.docker.com/linux/centos/docker-ce.repo
 - name: Install Docker (Ubuntu)
   block:
     - name: Install Docker requirements
-      apt: 'name=apt-transport-https state=present'
+      apt:
+        name:
+          - apt-transport-https
+          - ca-certificates
+          - curl
+          - software-properties-common
+        state: present
     - name: Add Docker apt-key
       apt_key:
         url: https://download.docker.com/linux/ubuntu/gpg
         state: present
     - name: Add Docker apt-repository
       apt_repository:
-        repo: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ansible_distribution_release}} stable'
+        repo: 'deb [arch={{host_arch}}] https://download.docker.com/linux/ubuntu {{ansible_distribution_release}} stable'
         state: present
     - name: Install Docker CE
       apt: name=docker-ce state=present update_cache=yes