diff --git a/multi-node-aio/build.sh b/multi-node-aio/build.sh
index ee13430e..04c1d076 100755
--- a/multi-node-aio/build.sh
+++ b/multi-node-aio/build.sh
@@ -49,11 +49,12 @@ ansible-playbook -vv \
-e cinder_vm_server_ram=${CINDER_VM_SERVER_RAM:-"2048"} \
-e compute_vm_server_ram=${COMPUTE_VM_SERVER_RAM:-"8196"} \
-e infra_vm_server_ram=${INFRA_VM_SERVER_RAM:-"8196"} \
- -e loadbalancer_vm_server_ram=${LOADBALANCER_VM_SERVER_RAM:-"1024"} \
- -e logging_vm_server_ram=${LOGGING_VM_SERVER_RAM:-"1024"} \
- -e swift_vm_server_ram=${SWIFT_VM_SERVER_RAM:-"1024"} \
+ -e loadbalancer_vm_server_ram=${LOADBALANCER_VM_SERVER_RAM:-"2048"} \
+ -e logging_vm_server_ram=${LOGGING_VM_SERVER_RAM:-"2048"} \
+ -e swift_vm_server_ram=${SWIFT_VM_SERVER_RAM:-"2048"} \
-e container_tech=${CONTAINER_TECH:-"lxc"} \
-e ipxe_kernel_url=${IPXE_KERNEL_URL:-"http://boot.ipxe.org/ipxe.lkrn"} \
-e ipxe_path_url=${IPXE_PATH_URL:-""} ${MNAIO_ANSIBLE_PARAMETERS} \
--force-handlers \
+ --flush-cache \
playbooks/site.yml
diff --git a/multi-node-aio/playbooks/deploy-pxe.yml b/multi-node-aio/playbooks/deploy-pxe.yml
index 0b2bb4b9..96bb43b3 100644
--- a/multi-node-aio/playbooks/deploy-pxe.yml
+++ b/multi-node-aio/playbooks/deploy-pxe.yml
@@ -106,49 +106,60 @@
owner: root
group: root
- - name: network scripts for pxe
+ - name: Generate PXE network scripts for Debian Family
template:
- src: "pxe/configs/{{ ansible_os_family | lower }}/{{ item.src }}"
+ src: "pxe/configs/debian/{{ item.src }}"
dest: /var/www/pxe/{{ item.dir }}/{{ item.dest }}
mode: "0644"
owner: root
group: root
with_items:
- src: basic-interface.cfg
- dest: "basic-{{ ansible_os_family | lower }}-interface.cfg"
+ dest: "basic-debian-interface.cfg"
dir: networking
- src: vm-post-install-script.sh.j2
- dest: "vm-post-install-{{ ansible_os_family | lower }}-script.sh"
+ dest: "vm-post-install-debian-script.sh"
dir: scripts
- src: general-post-install-script.sh.j2
- dest: "general-post-install-{{ ansible_os_family | lower }}-script.sh"
+ dest: "general-post-install-debian-script.sh"
dir: scripts
+ when: images[default_vm_image]['image_type'] | lower == "debian"
- - name: network scripts for an MNAIO
+ - name: Generate guest networking scripts for Debian Family
template:
- src: "pxe/configs/{{ ansible_os_family | lower }}/{{ item.src }}"
- dest: /var/www/pxe/{{ item.dir }}/{{ item.dest }}
- mode: "0644"
- owner: root
- group: root
- when:
- - groups['mnaio_hosts'] | default([]) | length > 0
- with_items:
- - src: mnaio-bridges.cfg.j2
- dest: mnaio-bridges.cfg
- dir: networking
- - src: mnaio-post-install-script.sh.j2
- dest: mnaio-post-install-{{ ansible_os_family | lower }}-script.sh
- dir: scripts
-
- - name: network scripts for servers
- template:
- src: "pxe/configs/{{ ansible_os_family | lower }}/vm-bridges.cfg.j2"
+ src: "pxe/configs/debian/vm-bridges.cfg.j2"
dest: /var/www/pxe/networking/{{ hostvars[item]['server_hostname'] }}-bridges.cfg
mode: "0644"
owner: root
group: root
with_items: "{{ groups['pxe_servers'] }}"
+ when: images[default_vm_image]['image_type'] | lower == "debian"
+
+ - name: Generate PXE network scripts for RedHat Family
+ template:
+ src: "pxe/configs/redhat/{{ item.src }}"
+ dest: /var/www/pxe/{{ item.dir }}/{{ item.dest }}
+ mode: "0644"
+ owner: root
+ group: root
+ with_items:
+ - src: vm-post-install-script.sh.j2
+ dest: "vm-post-install-redhat-script.sh"
+ dir: scripts
+ - src: general-post-install-script.sh.j2
+ dest: "general-post-install-redhat-script.sh"
+ dir: scripts
+ when: images[default_vm_image]['image_type'] | lower == "redhat"
+
+ - name: Generate systemd-network scripts for Red Hat Family
+ template:
+ src: "pxe/configs/redhat/systemd-network.sh.j2"
+ dest: /var/www/pxe/networking/{{ hostvars[item]['server_hostname'] }}-systemd-network.sh
+ mode: "0644"
+ owner: root
+ group: root
+ with_items: "{{ groups['pxe_servers'] }}"
+ when: images[default_vm_image]['image_type'] | lower == "redhat"
- name: tftp configs for servers
template:
@@ -159,18 +170,9 @@
group: root
with_items: "{{ groups['pxe_servers'] }}"
- - name: Preseeds for pxe mnaio
- template:
- src: "pxe/configs/{{ ansible_os_family | lower }}/mnaio.config.j2"
- dest: /var/www/pxe/configs/mnaio.config
- mode: "0644"
- owner: root
- group: root
- with_dict: "{{ images }}"
-
- name: Preseeds for pxe vm
template:
- src: "pxe/configs/{{ ansible_os_family | lower }}/vm.config.j2"
+ src: "pxe/configs/{{ images[default_vm_image]['image_type'] | lower }}/vm.config.j2"
dest: /var/www/pxe/configs/vm.config
mode: "0644"
owner: root
@@ -179,31 +181,13 @@
- name: Preseeds for pxe vm-compute
template:
- src: "pxe/configs/{{ ansible_os_family | lower }}/vm-compute.config.j2"
+ src: "pxe/configs/{{ images[default_vm_image]['image_type'] | lower }}/vm-compute.config.j2"
dest: /var/www/pxe/configs/vm-compute.config
mode: "0644"
owner: root
group: root
with_dict: "{{ images }}"
- - name: Preseeds for pxe compute
- template:
- src: "pxe/configs/{{ ansible_os_family | lower }}/compute.config.j2"
- dest: /var/www/pxe/configs/compute.config
- mode: "0644"
- owner: root
- group: root
- with_dict: "{{ images }}"
-
- - name: Preseeds for pxe infra
- template:
- src: "pxe/configs/{{ ansible_os_family | lower }}/infra.config.j2"
- dest: /var/www/pxe/configs/infra.config
- mode: "0644"
- owner: root
- group: root
- with_dict: "{{ images }}"
-
- name: Ensure permissions are correct
file:
dest: "{{ item }}"
diff --git a/multi-node-aio/playbooks/group_vars/all.yml b/multi-node-aio/playbooks/group_vars/all.yml
index 9cc8ec56..05972f22 100644
--- a/multi-node-aio/playbooks/group_vars/all.yml
+++ b/multi-node-aio/playbooks/group_vars/all.yml
@@ -26,6 +26,8 @@ default_ubuntu_mirror_proxy: 'http://10.0.2.1:3142/'
default_ubuntu_mirror_hostname: archive.ubuntu.com
default_ubuntu_mirror_directory: /ubuntu
+default_proxy_url: 'http://10.0.2.1:3142/'
+
default_container_tech: "{{ container_tech | default('lxc') }}"
ipxe_kernel_url: "http://boot.ipxe.org/ipxe.lkrn"
@@ -48,21 +50,12 @@ images:
image_netboot_kernel_url: "http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux"
image_netboot_initrd_url: "http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz"
image_configs:
- mnaio:
- url: "http://{{ tftp_server }}/configs/mnaio.config"
- template_name: "mnaio.config"
vm:
url: "http://{{ tftp_server }}/configs/vm.config"
template_name: "vm.config"
vm-compute:
url: "http://{{ tftp_server }}/configs/vm-compute.config"
template_name: "vm-compute.config"
- compute:
- url: "http://{{ tftp_server }}/configs/compute.config"
- template_name: "compute.config"
- infra:
- url: "http://{{ tftp_server }}/configs/infra.config"
- template_name: "infra.config"
ubuntu-16.04-amd64:
image_type: "debian"
image_os: "ubuntu"
@@ -71,21 +64,12 @@ images:
image_netboot_kernel_url: "http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux"
image_netboot_initrd_url: "http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz"
image_configs:
- mnaio:
- url: "http://{{ tftp_server }}/configs/mnaio.config"
- template_name: "mnaio.config"
vm:
url: "http://{{ tftp_server }}/configs/vm.config"
template_name: "vm.config"
vm-compute:
url: "http://{{ tftp_server }}/configs/vm-compute.config"
template_name: "vm-compute.config"
- compute:
- url: "http://{{ tftp_server }}/configs/compute.config"
- template_name: "compute.config"
- infra:
- url: "http://{{ tftp_server }}/configs/infra.config"
- template_name: "infra.config"
ubuntu-14.04-amd64:
image_type: "debian"
image_os: "ubuntu"
@@ -94,21 +78,27 @@ images:
image_netboot_kernel_url: "http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux"
image_netboot_initrd_url: "http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz"
image_configs:
- mnaio:
- url: "http://{{ tftp_server }}/configs/mnaio.config"
- template_name: "mnaio.config"
vm:
url: "http://{{ tftp_server }}/configs/vm.config"
template_name: "vm.config"
vm-compute:
url: "http://{{ tftp_server }}/configs/vm-compute.config"
template_name: "vm-compute.config"
- compute:
- url: "http://{{ tftp_server }}/configs/compute.config"
- template_name: "compute.config"
- infra:
- url: "http://{{ tftp_server }}/configs/infra.config"
- template_name: "infra.config"
+ centos-7-amd64:
+ image_type: "redhat"
+ image_version: 7
+ image_netboot_kernel_url: "http://mirrors.edge.kernel.org/centos/7/os/x86_64/images/pxeboot/vmlinuz"
+ image_netboot_initrd_url: "http://mirrors.edge.kernel.org/centos/7/os/x86_64/images/pxeboot/initrd.img"
+ image_repo_base_url: "http://mirrors.edge.kernel.org/centos/7"
+ image_kernel_options: ""
+ image_configs:
+ vm:
+ url: "http://{{ tftp_server }}/configs/vm.config"
+ template_name: "vm.config"
+ vm-compute:
+ url: "http://{{ tftp_server }}/configs/vm-compute.config"
+ template_name: "vm-compute.config"
+
# mnaio_data_disk: 'sdc' # str - not required, set this to define a given data disk if no data disk
# is defined the largest unpartitioned disk will be used.
mnaio_host_networks:
diff --git a/multi-node-aio/playbooks/kvm/kvm-vm.xml.j2 b/multi-node-aio/playbooks/kvm/kvm-vm.xml.j2
index b7c55f32..5b0e50a9 100644
--- a/multi-node-aio/playbooks/kvm/kvm-vm.xml.j2
+++ b/multi-node-aio/playbooks/kvm/kvm-vm.xml.j2
@@ -82,7 +82,7 @@
-
+
diff --git a/multi-node-aio/playbooks/pxe/configs/redhat/general-post-install-script.sh.j2 b/multi-node-aio/playbooks/pxe/configs/redhat/general-post-install-script.sh.j2
new file mode 100644
index 00000000..d472750c
--- /dev/null
+++ b/multi-node-aio/playbooks/pxe/configs/redhat/general-post-install-script.sh.j2
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+wget --no-proxy http://{{ tftp_server }}/networking/$(cat /etc/hostname)-systemd-network.sh -O /opt/systemd-network.sh
+chmod +x /opt/systemd-network.sh
+/opt/systemd-network.sh
diff --git a/multi-node-aio/playbooks/pxe/configs/redhat/systemd-network.sh.j2 b/multi-node-aio/playbooks/pxe/configs/redhat/systemd-network.sh.j2
new file mode 100644
index 00000000..f382330c
--- /dev/null
+++ b/multi-node-aio/playbooks/pxe/configs/redhat/systemd-network.sh.j2
@@ -0,0 +1,52 @@
+#!/bin/bash
+# this script generates the networking using systemd-networkd
+{% set server_networks = hostvars[item]['server_networks'] %}
+
+mkdir -p /etc/systemd/network
+systemctl disable network
+systemctl disable NetworkManager
+systemctl enable systemd-networkd
+systemctl enable systemd-resolved
+systemctl start systemd-resolved
+rm -f /etc/resolv.conf
+ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
+{% if hostvars[item]['server_hostname'] == 'loadbalancer1' %}
+# set nonlocal binding for haproxy
+echo "net.ipv4.ip_nonlocal_bind=1" >> /etc/sysctl.conf
+sysctl -p
+{% endif %}
+
+{% for key, value in server_networks.items()|sort(attribute='1.iface') %}
+# generate physical network devices
+cat </etc/systemd/network/{{ value.iface }}.network
+[Match]
+Name={{ value.iface }}
+
+[Network]
+Bridge=br-{{ key }}
+EOF
+
+# generate bridge net devices
+cat </etc/systemd/network/br-{{ key }}.netdev
+[NetDev]
+Name=br-{{ key }}
+Kind=bridge
+EOF
+
+# generate network files
+cat </etc/systemd/network/br-{{ key }}.network
+[Match]
+Name=br-{{ key }}
+
+[Network]
+{% if value.inet_type == 'dhcp' %}
+DHCP=yes
+
+[DHCP]
+UseDNS=yes
+UseNTP=yes
+{% elif value.address is defined %}
+Address={{ value.address }}
+{% endif %}
+EOF
+{% endfor %}
diff --git a/multi-node-aio/playbooks/pxe/configs/redhat/vm-compute.config.j2 b/multi-node-aio/playbooks/pxe/configs/redhat/vm-compute.config.j2
new file mode 100644
index 00000000..5ef267bc
--- /dev/null
+++ b/multi-node-aio/playbooks/pxe/configs/redhat/vm-compute.config.j2
@@ -0,0 +1,63 @@
+# Server Kickstart - compute
+install
+text
+lang en_US
+keyboard us
+timezone --utc Etc/UTC
+auth --useshadow --enablemd5
+selinux --disabled
+firewall --disabled
+services --enabled=NetworkManager,sshd
+eula --agreed
+ignoredisk --only-use=vda
+reboot
+
+bootloader --location=mbr
+zerombr
+clearpart --all --initlabel
+part /boot --fstype ext3 --size=512
+part pv.01 --size=1 --grow
+volgroup vmvg00 pv.01
+logvol / --fstype ext4 --name=root00 --vgname=vmvg00 --size=8192
+logvol swap --fstype swap --name=swap00 --vgname=vmvg00 --size=2048
+logvol /openstack --fstype ext4 --name=openstack00 --vgname=vmvg00 --size=16384
+logvol /var/lib/nova --fstype xfs --name=nova00 --vgname=vmvg00 --size=8192 --grow
+rootpw secrete
+repo --name=base --baseurl={{ images[default_vm_image]['image_repo_base_url'] }}/os/x86_64/
+repo --name=updates --baseurl={{ images[default_vm_image]['image_repo_base_url'] }}/updates/x86_64/
+url --url="{{ images[default_vm_image]['image_repo_base_url'] }}/os/x86_64/" --proxy {{ default_proxy_url }}
+
+%packages --nobase --ignoremissing
+@core
+wget
+bridge-utils
+dstat
+git
+python
+systemd-networkd
+systemd-resolved
+tmux
+vim
+%end
+
+%post
+(set -x
+echo
+echo "################################"
+echo "# Running Post Configuration #"
+echo "################################"
+# install ssh key
+mkdir -m0700 /root/.ssh/
+cat </root/.ssh/authorized_keys
+{{ tftp_ssh_key }}
+EOF
+chmod 0600 /root/.ssh/authorized_keys
+
+# set apt-cacher-ng proxy
+sed -i '/\[main\]/a proxy={{ default_proxy_url }}' /etc/yum.conf
+
+wget --no-proxy http://{{ tftp_server }}/scripts/general-post-install-redhat-script.sh -O /opt/general-post-install-script.sh
+chmod +x /opt/general-post-install-script.sh
+/opt/general-post-install-script.sh
+) > /root/post_install.log 2>&1
+%end
diff --git a/multi-node-aio/playbooks/pxe/configs/redhat/vm-post-install-script.sh.j2 b/multi-node-aio/playbooks/pxe/configs/redhat/vm-post-install-script.sh.j2
new file mode 100644
index 00000000..d472750c
--- /dev/null
+++ b/multi-node-aio/playbooks/pxe/configs/redhat/vm-post-install-script.sh.j2
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+wget --no-proxy http://{{ tftp_server }}/networking/$(cat /etc/hostname)-systemd-network.sh -O /opt/systemd-network.sh
+chmod +x /opt/systemd-network.sh
+/opt/systemd-network.sh
diff --git a/multi-node-aio/playbooks/pxe/configs/redhat/vm.config.j2 b/multi-node-aio/playbooks/pxe/configs/redhat/vm.config.j2
new file mode 100644
index 00000000..a701fdc7
--- /dev/null
+++ b/multi-node-aio/playbooks/pxe/configs/redhat/vm.config.j2
@@ -0,0 +1,76 @@
+# Server Kickstart - vm
+install
+text
+lang en_US
+keyboard us
+timezone --utc Etc/UTC
+auth --useshadow --enablemd5
+selinux --disabled
+firewall --disabled
+services --enabled=NetworkManager,sshd
+eula --agreed
+ignoredisk --only-use=vda
+reboot
+
+bootloader --location=mbr
+zerombr
+clearpart --all --initlabel
+part /boot --fstype ext3 --size=512
+part pv.01 --size=1 --grow
+volgroup vmvg00 pv.01
+logvol / --fstype ext4 --name=root00 --vgname=vmvg00 --size=8192
+logvol swap --fstype swap --name=swap00 --vgname=vmvg00 --size=2048
+logvol /openstack --fstype ext4 --name=openstack00 --vgname=vmvg00 --size=16384
+{% if default_container_tech == 'nspawn' %}
+logvol /var/lib/machines --fstype ext4 --name=machines00 --vgname=vmvg00 --size=8192 --grow
+{% elif default_container_tech == 'lxc' %}
+logvol /var/lib/machines --fstype ext4 --name=machines00 --vgname=vmvg00 --size=4096
+logvol /var/lib/lxc --fstype ext4 --name=lxc00 --vgname=vmvg00 --size=8192 --grow
+{% endif %}
+rootpw secrete
+repo --name=base --baseurl={{ images[default_vm_image]['image_repo_base_url'] }}/os/x86_64/
+repo --name=updates --baseurl={{ images[default_vm_image]['image_repo_base_url'] }}/updates/x86_64/
+url --url="{{ images[default_vm_image]['image_repo_base_url'] }}/os/x86_64/" --proxy {{ default_proxy_url }}
+
+%packages --nobase --ignoremissing
+@core
+wget
+bridge-utils
+btrfs-progs
+dstat
+git
+python
+systemd-networkd
+systemd-resolved
+tmux
+vim
+%end
+
+%post
+(set -x
+echo
+echo "################################"
+echo "# Running Post Configuration #"
+echo "################################"
+# install ssh key
+mkdir -m0700 /root/.ssh/
+cat </root/.ssh/authorized_keys
+{{ tftp_ssh_key }}
+EOF
+chmod 0600 /root/.ssh/authorized_keys
+
+# set apt-cacher-ng proxy
+sed -i '/\[main\]/a proxy={{ default_proxy_url }}' /etc/yum.conf
+
+# kickstart has issues setting fstype to btrfs, so this converts the machines lvm partition to btrfs
+modprobe btrfs
+umount /dev/vmvg00/machines00
+btrfs-convert /dev/vmvg00/machines00
+sed -i '/vmvg00-machines00/d' /etc/fstab
+echo "/dev/mapper/vmvg00-machines00 /var/lib/machines btrfs defaults 1 2" >> /etc/fstab
+
+wget --no-proxy http://{{ tftp_server }}/scripts/vm-post-install-redhat-script.sh -O /opt/vm-post-install-script.sh
+chmod +x /opt/vm-post-install-script.sh
+/opt/vm-post-install-script.sh
+) > /root/post_install.log 2>&1
+%end
diff --git a/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.macaddr.j2 b/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.macaddr.j2
index bd4c8675..26946a67 100644
--- a/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.macaddr.j2
+++ b/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.macaddr.j2
@@ -7,4 +7,7 @@ initrd {{ image_properties['image_netboot_initrd_url'] }}
{% if image_properties['image_type'] == 'debian' %}
imgargs linux hostname={{ server_vars['server_hostname'] }} {{ image_properties['image_kernel_options'] }} preseed/url={{ image_properties['image_configs'][server_vars['server_preseed_ks']]['url'] }} preseed/interactive=false netcfg/choose_interface={{ server_vars['server_default_interface'] }} netcfg/get_domain={{ server_vars['server_domain_name'] }} initrd=initrd.gz {{ server_vars['server_extra_options'] | default('') }}
{% endif %}
+{% if image_properties['image_type'] == 'redhat' %}
+imgargs vmlinuz hostname={{ server_vars['server_hostname'] }} {{ image_properties['image_kernel_options'] }} ks={{ image_properties['image_configs'][server_vars['server_preseed_ks']]['url'] }} BOOTIF=${netX/mac} initrd=initrd.img {{ server_vars['server_extra_options'] | default('') }}
+{% endif %}
boot