summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorckonstanski <ckonstanski@pippiandcarlos.com>2017-11-20 10:55:28 -0700
committerckonstanski <ckonstanski@pippiandcarlos.com>2017-11-20 10:55:28 -0700
commit8f503e0aff61fd4b39b76cb8dd793c8554d6132c (patch)
tree4640244b3423158eda1b9cb0dbb5d7f80845c5a1
parent13453088f9060b1e82c61d5143c48d2017da60c4 (diff)
Install diskimage-builder on jenkins slave
Issue: IS-31
-rw-r--r--pillar/openbook/ansible.sls6
-rw-r--r--salt/openbook/ansible/files/diskimage_builder.yaml51
-rw-r--r--salt/openbook/ansible/files/install_openbook_docker_slave.yaml1
3 files changed, 58 insertions, 0 deletions
diff --git a/pillar/openbook/ansible.sls b/pillar/openbook/ansible.sls
index 2b6fb11..867dc65 100644
--- a/pillar/openbook/ansible.sls
+++ b/pillar/openbook/ansible.sls
@@ -57,6 +57,12 @@ ansible:
mode: "0644"
relative_to_buildroot: True
is_template: False
+ playbooks_diskimage_builder_yaml:
+ name: playbooks/diskimage_builder.yaml
+ source: diskimage_builder.yaml
+ mode: "0644"
+ relative_to_buildroot: True
+ is_template: False
playbooks_docker_compose_yaml:
name: playbooks/docker_compose.yaml
source: docker_compose.yaml
diff --git a/salt/openbook/ansible/files/diskimage_builder.yaml b/salt/openbook/ansible/files/diskimage_builder.yaml
new file mode 100644
index 0000000..4a0fbfd
--- /dev/null
+++ b/salt/openbook/ansible/files/diskimage_builder.yaml
@@ -0,0 +1,51 @@
+---
+- name: "Install diskimage-builder"
+ hosts: all
+ tasks:
+ - name: "Update apt"
+ apt:
+ update_cache: yes
+ when: ansible_distribution == "Ubuntu"
+
+ - name: "Install packages"
+ apt:
+ pkg: "{{ item }}"
+ state: present
+ with_items:
+ - qemu
+ - parted
+ - kpartx
+ - python-yaml
+ when: ansible_distribution == "Ubuntu"
+
+ - name: "Discover whether pip is installed"
+ shell: which pip && echo "true" || echo "false"
+ register: pip_installed
+
+ - name: "Install pip"
+ shell: |
+ mkdir -p /tmp/pip
+ cd /tmp/pip
+ wget https://bootstrap.pypa.io/get-pip.py
+ python get-pip.py
+ pip install --upgrade pip dib-utils networkx
+ when: ansible_distribution == "Ubuntu" and pip_installed.stdout == "false"
+
+ - name: "Install diskimage-builder"
+ shell: |
+ mkdir -p /tmp/diskimage-builder
+ cd /tmp/diskimage-builder
+ git clone https://github.com/openstack/diskimage-builder.git
+ cd diskimage-builder
+ pip install --upgrade -r requirements.txt
+ python setup.py install
+ when: ansible_distribution == "Ubuntu"
+
+ - name: "Install packages"
+ portage:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - app-emulation/diskimage-builder
+ - app-emulation/qemu
+ when: ansible_distribution == "Gentoo"
diff --git a/salt/openbook/ansible/files/install_openbook_docker_slave.yaml b/salt/openbook/ansible/files/install_openbook_docker_slave.yaml
index ebcec43..e294ea8 100644
--- a/salt/openbook/ansible/files/install_openbook_docker_slave.yaml
+++ b/salt/openbook/ansible/files/install_openbook_docker_slave.yaml
@@ -1,6 +1,7 @@
---
- include: salt.yaml
- include: docker.yaml
+- include: diskimage_builder.yaml
- include: mysql_client.yaml
- include: openjdk.yaml
- include: gradle.yaml