Skip to content

Commit

Permalink
NR-164383 feat: install docker in old suse distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenruizdegauna committed Jan 9, 2024
1 parent d01b069 commit 131480e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Docker]
name=Docker
enabled=1
autorefresh=0
baseurl=http://download.opensuse.org/distribution/leap/15.1/repo/oss/
type=rpm-md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
force: yes
retries: 5
delay: 60
when: ansible_distribution_version not in suse_versions_wo_docker

- name: install docker in old version
ansible.builtin.include_tasks: "install-docker-SLES_old.yaml"
when: ansible_distribution_version in suse_versions_wo_docker

- name: install docker-compose (manual)
shell: "DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} && mkdir -p $DOCKER_CONFIG/cli-plugins && mkdir -p /usr/local/lib/docker/cli-plugins/ && curl -SL https://github.com/docker/compose/releases/download/v{{ docker_compose_version }}/docker-compose-linux-{{ ansible_architecture }} -o $DOCKER_CONFIG/cli-plugins/docker-compose && sudo cp $DOCKER_CONFIG/cli-plugins/docker-compose /usr/local/lib/docker/cli-plugins/docker-compose && sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose"

...
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---

# Use OpenSUSE 15.1 repo to install docker
- name: install OpenSUSE 15.1 repo for docker
copy:
src: open-suse-15.1.repo
dest: /etc/zypp/repos.d/open-suse-15.1.repo

- name: zypper refresh Docker
command: zypper refresh Docker

# python-PyYAML is used by aws-cli that we don't use in canaries
- name: remove python-PyYAML that conflicts with this version of docker
zypper:
name: "python-PyYAML"
state: absent
oldpackage: yes
update_cache: yes
force: yes

- name: install docker and docker-compose
command: zypper install -y --from Docker docker

# remove repo
- name: install OpenSUSE 15.1 repo for docker
file:
path: /etc/zypp/repos.d/open-suse-15.1.repo
state: absent

- name: zypper refresh
command: zypper refresh

...
2 changes: 1 addition & 1 deletion caos.ansible_roles/roles/docker_install/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- name: install docker
include: "install-docker-{{ ansible_distribution }}.yaml"
ansible.builtin.include_tasks: "install-docker-{{ ansible_distribution }}.yaml"

- name: ensure docker service is started
ansible.builtin.service:
Expand Down
5 changes: 4 additions & 1 deletion caos.ansible_roles/roles/docker_install/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
docker_compose_version: 2.12.2
docker_compose_version: 2.12.2
suse_versions_wo_docker:
- "12.3"
- "12.4"

0 comments on commit 131480e

Please sign in to comment.