view main.yml @ 2:e8555f703e69

use python3
author anatofuz
date Sun, 26 May 2019 10:08:59 +0900
parents d8ead3008bd2
children 0b8c5ca67cfd
line wrap: on
line source

#  build debugging qemu from source
#      anatofuz@cr.ie.u-ryukyu.ac.jp
#
#   rsync -av -e 'ssh -p 2222' ~/.ssh/id_rsa.pub xxx@localhost:.ssh/authorized_keys
#   screen -L  ansible-playbook -i hosts main.yml --ask-become-pass
#   ssh localhost -p 2222  -l root 'cd /usr/src/kernels ; tar czf - fedora' | dd of=fedora26-kernel.tgz

- hosts: all
  remote_user: syster_clown
  become: yes
  become_method: sudo
  vars:
    qemu_version: 4.0.0
    csum: 13a93dfe75b86734326f8d5b475fde82ec692d5b5a338b4262aeeb6b0fa4e469
    ansible_python_interpreter: /usr/bin/python3

  pre_tasks:
  - name: Get ansible_user home directory
    shell: 'getent passwd "{{ansible_ssh_user}}" | cut -d: -f6'
    register: ansible_home_result

  - name: Set the fact for the other scripts to use
    set_fact: ansible_home='{{ansible_home_result.stdout}}'

  tasks:
  - name: install qemu dev packages
    dnf:
        name: ['wget', 'gcc', 'gdb', 'make', 'pixman-devel', 'python'] 
        state: present

  - name: create_download_src_directory
    file: path={{ ansible_home }}/src
          state=directory

  - name: create_build_directory
    file: path={{ ansible_home }}/build
          state=directory

  - name: download qemu source code
    get_url: url=https://download.qemu.org/qemu-{{ qemu_version }}.tar.xz
             dest=~/src/qemu-{{ qemu_version }}.tar.xz sha256sum={{ csum }}
    register: download_qemu_code

  - name: unarchive a qemu sorce
    shell: "{{ item }}"
    with_items: 
    - tar -xvf qemu-{{ qemu_version }}.tar.xz
    args:
      chdir: "{{ ansible_home }}/src/"

  - name: execute configure
    shell: './configure --target-list=i386-softmmu,x86_64-softmmu,arm-softmmu,arm-linux-user --enable-kvm --enable-debug --prefix={{ ansible_home }}/build'
    args:
      chdir: "{{ ansible_home }}/src/qemu-{{ qemu_version }}"

    #
    #- name: install kernel
    #  shell: "{{ item }}"
    #  with_items:
    #  - make install
    #  args:
    #    chdir: /usr/src/kernels/fedora