# todo - split drbd parts into another include # todo - allow maintenance mode with rc.local_shutdown - set_fact: baseline_pkgs: - bridge-utils - libnl3 # required by xen-nox - lzo # required by xen-nox - pixman # required by xen-nox /usr/lib/xen/bin/qemu-system-i386 - name: required baseline packages 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-* >/dev/null 2>&1 && echo there || echo WILL INSTALL IN PLAY elif [[ {{ansible_check_mode}} = False ]]; then ls /var/log/packages/$pkgname-* >/dev/null 2>&1 && echo there || 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 != '' # todo - grab the packages - name: required sbo packages ansible.builtin.shell: executable: /bin/bash cmd: | set -e [[ -d slackpkgs-gonzales3/ ]] for f in slackpkgs-gonzales3/*.tgz; do pkgname=${f##*/} pkgname=${pkgname%%-*} echo -n $pkgname ... if [[ {{ansible_check_mode}} = True ]]; then ls /var/log/packages/$pkgname-* >/dev/null 2>&1 && echo there || echo WILL INSTALL IN PLAY elif [[ {{ansible_check_mode}} = False ]]; then ls /var/log/packages/$pkgname-* >/dev/null 2>&1 && echo there || installpkg --terse $f fi done; unset f [[ -L /boot/xen.gz ]] && ln -sf boot/xen.gz /xen.gz ls -lhFL /xen.gz ls -lhF /vmlinuz-huge-xen register: sbo changed_when: > 'WILL INSTALL IN PLAY' in baseline.stdout or 'Installing package' in baseline.stdout check_mode: false - debug: var=sbo.stdout when: sbo.stdout != '' - debug: var=sbo.stderr when: sbo.stderr != '' - name: rc.local ansible.builtin.copy: content: | #!/bin/bash # CONFIGURED BY ANSIBLE echo rc.local PATH is $PATH PATH=$PATH:/usr/local/sbin:/usr/local/bin:/etc/rc.d echo rc.local PATH is $PATH # self-verbose #drbdadm up -v all rc.drbd start # self-verbose /etc/rc.d/init.d/xencommons start dest: /etc/rc.d/rc.local mode: "0755" - name: syslinux boots xen ansible.builtin.copy: content: | # CONFIGURED BY ANSIBLE serial 0 115200 console 1 nohalt 1 default xen prompt 1 timeout 30 label xen kernel mboot.c32 append /xen.gz dom0_mem=512M noreboot=true loglvl=info guest_loglvl=info smt=1 ept=exec-sp com1=115200,8n1 console=com1,vga --- /vmlinuz-huge-xen root=/dev/vda1 ro console=hvc0 earlyprintk=xen mitigations=off label huge-xen linux /vmlinuz-huge-xen append root=/dev/vda1 ro console=tty1 console=ttyS0,115200n8 mitigations=off label linux linux /boot/vmlinuz append root=/dev/vda1 ro console=tty1 console=ttyS0,115200n8 mitigations=off dest: /boot/syslinux/syslinux.cfg - name: console goes hvc0 ansible.builtin.lineinfile: path: /etc/inittab regexp: '^s1:' line: 's1:12345:respawn:/sbin/agetty --noclear --local-line hvc0 115200 linux' # todo - keep nodes defined from ansible or switch to dnc.conf? - name: sync drbd resources script ansible.builtin.copy: content: | #!/bin/bash # CONFIGURED BY ANSIBLE nodes="{{ nodes | join(' ') }}" for node in $nodes; do [[ $node = $HOSTNAME ]] && continue rsync -avz --delete /etc/drbd.d/ $node:/etc/drbd.d/ done; unset node dest: /root/sync mode: "0755" when: sync_from is defined