- name: define required baseline packages set_fact: baseline_pkgs: - bridge-utils - brotli # required by git through http - git cyrus-sasl # deploy dnc from git repository - libnl3 # required by xen-nox - lvm2 # just in case (although we might be using zfs instead) - lzo # required by xen-nox - nftables jansson libnftnl iptables libpcap dbus-1 # network convergence - pixman # required by xen-nox /usr/lib/xen/bin/qemu-system-i386 # todo - less verbose slackpkgs output - name: check baseline packages are installed shell: executable: /bin/bash cmd: | set -e for pkgname in {{ baseline_pkgs | join(' ') }}; do echo -n $pkgname ... if [[ {{ansible_check_mode}} = True ]]; then ls /var/log/packages/$pkgname* 2>/dev/null || echo WILL INSTALL IN PLAY elif [[ {{ansible_check_mode}} = False ]]; then ls /var/log/packages/$pkgname* 2>/dev/null || slackpkg -dialog=off -batch=on -default_answer=y install $pkgname fi done; unset pkgname register: baseline changed_when: > 'WILL INSTALL IN PLAY' in baseline.stdout or 'Installing package' in baseline.stdout check_mode: false - debug: var=baseline.stdout when: baseline.stdout != '' - debug: var=baseline.stderr when: baseline.stderr != '' - name: download required pre-built sbo packages shell: executable: /bin/bash cmd: | set -e cd /root/ wget -q -T3 -t1 https://lab.nethence.com/slackpkgs-gonzales.tar creates: /root/slackpkgs-gonzales.tar # todo - handle gonzales archive updates - name: install required sbo packages shell: executable: /bin/bash cmd: | set -e if [[ {{ansible_check_mode}} = False && ! -d slackpkgs-gonzales/ ]]; then tar xf slackpkgs-gonzales.tar fi for f in slackpkgs-gonzales/*.tgz; do pkgname=${f##*/} pkgname=${pkgname%%-*} echo -n $pkgname ... if [[ {{ansible_check_mode}} = True ]]; then ls /var/log/packages/$pkgname* 2>/dev/null || echo WILL INSTALL IN PLAY elif [[ {{ansible_check_mode}} = False ]]; then ls /var/log/packages/$pkgname* 2>/dev/null || installpkg --terse $f fi done; unset f # check third-party packages are now installed if [[ {{ansible_check_mode}} = False ]]; then which dsh which debootstrap ls -lhF /usr/lib64/libfdt.so which drbdadm which zpool [[ -L /boot/xen.gz ]] && ln -sf boot/xen.gz /xen.gz ls -lhF /boot/xen*.gz ls -lhF /xen.gz ls -lhF /usr/lib64/libyajl.so fi register: sbo changed_when: > 'WILL INSTALL IN PLAY' in sbo.stdout or 'Installing package' in sbo.stdout check_mode: false - debug: var=sbo.stdout when: sbo.stdout != '' - debug: var=sbo.stderr when: sbo.stderr != '' # make it clear what we're gonna download - debug: var=custom_ver - name: download xen-compatible linux kernel shell: executable: /bin/bash cmd: | set -e cd / wget -q -T 3 -t 1 {{item}} # quick hack - creates simply checks for vmlinuz not config creates: "/{{custom_ver}}.vmlinuz" with_items: - https://lab.nethence.com/nunux/dom0/{{custom_ver}}.config - https://lab.nethence.com/nunux/dom0/{{custom_ver}}.vmlinuz # todo - add reiser4? - name: check built-in drivers shell: executable: /bin/bash cmd: | set -e grep ^{{item}}=y /{{custom_ver}}.config changed_when: false check_mode: false with_items: - CONFIG_XEN_PVH - CONFIG_UFS_FS_WRITE - "{{ 'CONFIG_USB_STORAGE' if memstick else '' }}" when: item != '' - name: download linux kernel modules shell: executable: /bin/bash cmd: | set -e cd /lib/modules/ wget -q -T 3 -t 1 https://lab.nethence.com/nunux/dom0/{{custom_ver}}.modules.tar.gz # better check for extracted dir instead of archive #creates: /lib/modules/{{custom_ver}}.modules.tar.gz creates: /lib/modules/{{custom_ver}}/ - name: deploy linux kernel modules shell: executable: /bin/bash cmd: | set -e cd /lib/modules/ if [[ ! -d {{custom_ver}}/ ]]; then tar xzf {{custom_ver}}.modules.tar.gz depmod -a {{custom_ver}} fi cd / if [[ -f vmlinuz && ! -L vmlinuz ]]; then echo /vmlinuz is not a symlink, remove or rename it first exit 1 fi ln -sf {{custom_ver}}.vmlinuz vmlinuz ls -ldhF /lib/modules/{{custom_ver}}/ ls -lhF /vmlinuz* register: output - debug: var=output.stdout when: not ansible_check_mode