- name: setup xen gather_facts: no hosts: "{{target}}" become: "{{become_var}}" tasks: # todo - split drbd parts into another include # todo - allow maintenance mode with rc.local_shutdown - 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're using zfs) - 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 ansible.builtin.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 ansible.builtin.get_url: url: https://lab.nethence.com/slackpkgs-gonzales.tar dest: /root/slackpkgs-gonzales.tar force: no # todo - handle gonzales archive updates - name: install required sbo packages ansible.builtin.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 != '' - name: download xen-compatible linux kernel ansible.builtin.get_url: url: "{{item}}" dest: / force: no with_items: - https://lab.nethence.com/nunux/dom0/{{custom_ver}}.config - https://lab.nethence.com/nunux/dom0/{{custom_ver}}.vmlinuz - name: download xen-compatible linux kernel modules ansible.builtin.get_url: url: "{{item}}" dest: /lib/modules force: no with_items: - https://lab.nethence.com/nunux/dom0/{{custom_ver}}.modules.tar.gz - name: deploy xen+compatible linux kernel ansible.builtin.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 / [[ ! -L vmlinuz ]] && ln -s {{custom_ver}}.vmlinuz vmlinuz ls -ldhF /lib/modules/{{custom_ver}}/ ls -lhF /vmlinuz* creates: /vmlinuz register: nunux - debug: var=nunux.msg when: nunux.msg != '' - debug: var=nunux.stdout when: nunux.stdout != '' #- name: hotfix ll alias # ansible.builtin.blockinfile: # content: | # alias ll='ls -alkF' # dest: /etc/profile