From 14f47a0f47990a7e51123fcabd6c124285ebdc45 Mon Sep 17 00:00:00 2001 From: Michal Zegan Date: Mon, 27 May 2019 14:01:50 +0200 Subject: Add the prepare-package-repository role This role may be used by infra playbook tests. It downloads docker rpm packages and their dependencies to disk and creates a simulated offline rpm repository that can then be used to test installation of packages. Change-Id: Ia1a1bed1b124e036219ccc12c4650ce446955f01 Issue-ID: OOM-1816 Signed-off-by: Michal Zegan Signed-off-by: Samuli Silvius --- .../prepare-package-repository/tasks/main.yml | 26 ++++++++++++++++++++++ .../roles/prepare-package-repository/vars/main.yml | 12 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 ansible/test/roles/prepare-package-repository/tasks/main.yml create mode 100644 ansible/test/roles/prepare-package-repository/vars/main.yml (limited to 'ansible') diff --git a/ansible/test/roles/prepare-package-repository/tasks/main.yml b/ansible/test/roles/prepare-package-repository/tasks/main.yml new file mode 100644 index 00000000..66f81d6d --- /dev/null +++ b/ansible/test/roles/prepare-package-repository/tasks/main.yml @@ -0,0 +1,26 @@ +--- +- name: Add Docker-CE repo + yum_repository: + name: docker-ce + description: Docker-ce YUM repo + baseurl: https://download.docker.com/linux/centos/7/x86_64/stable/ + gpgcheck: true + gpgkey: https://download.docker.com/linux/centos/gpg + +- name: Install createrepo + yum: + name: createrepo + state: present + +- name: "Ensure {{ rhel_pkg_dir }} exists" + file: + path: "{{ rhel_pkg_dir }}" + state: directory + +- name: Download rpm packages + command: "yumdownloader --destdir={{ rhel_pkg_dir }} --resolve {{ packages | join(' ') }}" + +- name: Index repository + command: "createrepo {{ rhel_pkg_dir }}" + args: + creates: "{{ rhel_pkg_dir }}/repodata" diff --git a/ansible/test/roles/prepare-package-repository/vars/main.yml b/ansible/test/roles/prepare-package-repository/vars/main.yml new file mode 100644 index 00000000..80944284 --- /dev/null +++ b/ansible/test/roles/prepare-package-repository/vars/main.yml @@ -0,0 +1,12 @@ +--- +rhel_pkg_dir: "{{ app_data_path }}/pkg/rhel" +packages: +- "docker-ce-18.09.5" +- container-selinux +- docker-ce-cli +- containerd.io +- python-jsonpointer +- python-docker-py +- python-docker-pycreds +- python-ipaddress +- python-websocket-client -- cgit 1.2.3-korg