summaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
authorMichal Zegan <m.zegan@samsung.com>2019-05-27 14:01:50 +0200
committerMichal Ptacek <m.ptacek@partner.samsung.com>2019-05-29 10:43:59 +0000
commit14f47a0f47990a7e51123fcabd6c124285ebdc45 (patch)
tree34d6b54fbae2dfd34f157e916966d83fc6bad88b /ansible
parent8aebe611faaab0274321f1797763fb1d645b98ec (diff)
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 <m.zegan@samsung.com> Signed-off-by: Samuli Silvius <s.silvius@partner.samsung.com>
Diffstat (limited to 'ansible')
-rw-r--r--ansible/test/roles/prepare-package-repository/tasks/main.yml26
-rw-r--r--ansible/test/roles/prepare-package-repository/vars/main.yml12
2 files changed, 38 insertions, 0 deletions
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