view main.yml @ 0:bb6fff966de1

init project (add main.yml)
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 26 May 2019 07:25:07 +0900
parents
children d8ead3008bd2
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: xxxx
  become: yes
  become_method: sudo
  vars:
    qemu_version: 4.0.0

  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={{ item }} state=present
    with_items: 
    - wget
    - gcc
    - gdb
    - make
    - pixman-devel

  - name: create_download_src_direcoty
    file: path={{ ansible_home }}/src
          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.xv
    args:
      chdir: ~/src

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

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