summaryrefslogtreecommitdiff
path: root/playbooks/diskimage_builder.yaml
blob: 4a0fbfd6c6c0d55ca5dbe7cc291a2bdc2525b303 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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"