From: Jeremy Phelps Date: Thu, 16 Aug 2018 19:53:17 +0000 (-0500) Subject: Parameterize arch with ansible_architecture X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=d3b1cc1f8702fd111e9085a126a733e908670051;p=ansible%2Froles%2Fdocker-install.git Parameterize arch with ansible_architecture Note that docker uses armhf instead of aarch64. Change-Id: I70c1734f9435f44dda3a314141ac0c1675b2a544 Signed-off-by: Jeremy Phelps --- diff --git a/tasks/main.yml b/tasks/main.yml index dc87459..2aec7f7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 @@ -19,14 +30,20 @@ - 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