From 2f503c228e91db13b449c3d31c5ac29960de0504 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Fri, 13 Oct 2017 18:53:56 -0500 Subject: [PATCH] Tune-up the MNAIO for physical and virtual hosts This change makes it possible to deploy ACNG within a physical host NOT automatically tied to an MNAIO installation. This also adds an infra preseed file which can be used to provision physical hosts. By default the domain name is now passed into the server boot params which is useful when setting up an environment in support of RFC-1034/5. Ubuntu 16.04 has an issue with the options "quiet splash" being passed in which cause it to have no usable console. See [Related-Issue] for more. Related-Issue: #1656605 Change-Id: I731dfb70e4b5d676d8c22082da77c0d22d5afb58 Signed-off-by: Kevin Carter --- multi-node-aio/playbooks/deploy-acng.yml | 95 +++++++ multi-node-aio/playbooks/deploy-pxe.yml | 19 +- multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 | 2 +- multi-node-aio/playbooks/group_vars/all.yml | 9 +- .../playbooks/host_vars/cinder1.yml | 1 + .../playbooks/host_vars/cinder2.yml | 1 + .../playbooks/host_vars/compute1.yml | 1 + .../playbooks/host_vars/compute2.yml | 1 + .../host_vars/example-host1.yml.example | 3 +- multi-node-aio/playbooks/host_vars/infra1.yml | 1 + multi-node-aio/playbooks/host_vars/infra2.yml | 1 + multi-node-aio/playbooks/host_vars/infra3.yml | 1 + .../playbooks/host_vars/loadbalancer1.yml | 1 + .../playbooks/host_vars/logging1.yml | 1 + multi-node-aio/playbooks/host_vars/swift1.yml | 1 + multi-node-aio/playbooks/host_vars/swift2.yml | 1 + multi-node-aio/playbooks/host_vars/swift3.yml | 1 + multi-node-aio/playbooks/kvm/kvm-vm.xml | 2 +- .../playbooks/pxe/debian/compute.preseed.j2 | 8 +- ...h.j2 => general-post-install-script.sh.j2} | 2 +- .../playbooks/pxe/debian/infra.preseed.j2 | 239 ++++++++++++++++++ .../debian/mnaio-bridges.cfg.j2 | 0 .../debian/mnaio-post-install-script.sh.j2 | 0 .../playbooks/pxe/debian/mnaio.preseed.j2 | 2 +- .../pxe/tftp/pxelinux.cfg.macaddr.j2 | 2 +- multi-node-aio/playbooks/setup-host.yml | 62 +---- multi-node-aio/playbooks/site.yml | 4 + 27 files changed, 383 insertions(+), 78 deletions(-) create mode 100644 multi-node-aio/playbooks/deploy-acng.yml rename multi-node-aio/playbooks/pxe/debian/{compute-post-install-script.sh.j2 => general-post-install-script.sh.j2} (88%) create mode 100644 multi-node-aio/playbooks/pxe/debian/infra.preseed.j2 rename multi-node-aio/playbooks/{mnaio => pxe}/debian/mnaio-bridges.cfg.j2 (100%) rename multi-node-aio/playbooks/{mnaio => pxe}/debian/mnaio-post-install-script.sh.j2 (100%) diff --git a/multi-node-aio/playbooks/deploy-acng.yml b/multi-node-aio/playbooks/deploy-acng.yml new file mode 100644 index 00000000..131b4fa5 --- /dev/null +++ b/multi-node-aio/playbooks/deploy-acng.yml @@ -0,0 +1,95 @@ +--- +# Copyright 2017, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in witing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Gather facts + hosts: pxe_hosts + pre_tasks: + - name: Gather variables for each operating system + include_vars: "{{ item }}" + with_first_found: + - "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml" + - "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml" + - "{{ playbook_dir }}/vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" + - "{{ playbook_dir }}/vars/{{ ansible_distribution | lower }}.yml" + - "{{ playbook_dir }}/vars/{{ ansible_os_family | lower }}.yml" + tags: + - always + + tasks: + - name: Install repo caching server packages + package: + name: "{{ item }}" + state: "latest" + with_items: "{{ mnaio_pkg_cache_server_distro_packages }}" + + - name: Create cache directory + file: + path: "/var/www/pkg-cache" + state: "directory" + owner: "apt-cacher-ng" + group: "www-data" + mode: "02775" + + - name: Stat the cache path + stat: + path: /var/cache/apt-cacher-ng + register: acs + + - name: Remove cacher directory if its a directory + file: + path: "/var/cache/apt-cacher-ng" + state: "absent" + when: + - acs.stat.isdir is defined and acs.stat.isdir + + - name: Link cacher to the repo path + file: + src: "/var/www/pkg-cache" + dest: "/var/cache/apt-cacher-ng" + state: "link" + + - name: create yum merged mirror list + shell: | + curl https://www.centos.org/download/full-mirrorlist.csv | sed 's/^.*"http:/http:/' | sed 's/".*$//' | grep ^http >/etc/apt-cacher-ng/centos_mirrors + echo "http://mirror.centos.org/centos/" >>/etc/apt-cacher-ng/centos_mirrors + + - name: Drop acng.conf + template: + src: "pxe/acng.conf.j2" + dest: "/etc/apt-cacher-ng/acng.conf" + notify: + - reload acng + + post_tasks: + - name: Drop apt package manager proxy + copy: + content: 'Acquire::http { Proxy "{{ default_ubuntu_mirror_proxy }}"; };' + dest: "/etc/apt/apt.conf.d/00apt-cacher-proxy" + + - name: Update apt when proxy is added + apt: + update_cache: yes + + environment: "{{ deployment_environment_variables | default({}) }}" + + handlers: + - name: reload acng + service: + name: "apt-cacher-ng" + state: restarted + enabled: yes + + tags: + - deploy-acng diff --git a/multi-node-aio/playbooks/deploy-pxe.yml b/multi-node-aio/playbooks/deploy-pxe.yml index 83190920..b6515afc 100644 --- a/multi-node-aio/playbooks/deploy-pxe.yml +++ b/multi-node-aio/playbooks/deploy-pxe.yml @@ -196,13 +196,13 @@ - src: vm-post-install-script.sh.j2 dest: "vm-post-install-{{ ansible_os_family | lower }}-script.sh" dir: scripts - - src: compute-post-install-script.sh.j2 - dest: "compute-post-install-{{ ansible_os_family | lower }}-script.sh" + - src: general-post-install-script.sh.j2 + dest: "general-post-install-{{ ansible_os_family | lower }}-script.sh" dir: scripts - name: network scripts for an MNAIO template: - src: "mnaio/{{ ansible_os_family | lower }}/{{ item.src }}" + src: "pxe/{{ ansible_os_family | lower }}/{{ item.src }}" dest: /var/www/pxe/{{ item.dir }}/{{ item.dest }} mode: "0644" owner: root @@ -214,7 +214,7 @@ dest: mnaio-bridges.cfg dir: networking - src: mnaio-post-install-script.sh.j2 - dest: mnaio-post-install-script.sh + dest: mnaio-post-install-{{ ansible_os_family | lower }}-script.sh dir: scripts - name: network scripts for servers @@ -229,7 +229,7 @@ - name: tftp configs for servers template: src: "pxe/tftp/pxelinux.cfg.macaddr.j2" - dest: "/var/lib/tftpboot/pxelinux.cfg/01-{{ hostvars[item]['server_mac_address'] | replace(':', '-') }}" + dest: "/var/lib/tftpboot/pxelinux.cfg/01-{{ hostvars[item]['server_mac_address'] | replace(':', '-') | lower }}" mode: "0644" owner: root group: root @@ -271,6 +271,15 @@ group: root with_dict: "{{ images }}" + - name: Preseeds for pxe infra + template: + src: "pxe/{{ ansible_os_family | lower }}/infra.preseed.j2" + dest: /var/lib/tftpboot/preseed/infra.preseed + mode: "0644" + owner: root + group: root + with_dict: "{{ images }}" + - name: Create netboot bind mount path file: path: "/var/lib/tftpboot/{{ item.value.image_short_name }}" diff --git a/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 b/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 index 24ac5738..87da8345 100644 --- a/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 +++ b/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 @@ -39,7 +39,7 @@ shared-network all-networks { group { {% for item in groups['pxe_servers'] %} host {{ hostvars[item]['server_hostname'] }} { - hardware ethernet {{ hostvars[item]['server_mac_address'] }}; + hardware ethernet {{ hostvars[item]['server_mac_address'] | lower }}; fixed-address {{ hostvars[item]['server_vm_fixed_addr'] }}; option host-name "{{ hostvars[item]['server_hostname'] }}"; } diff --git a/multi-node-aio/playbooks/group_vars/all.yml b/multi-node-aio/playbooks/group_vars/all.yml index 793fa061..c7c9da90 100644 --- a/multi-node-aio/playbooks/group_vars/all.yml +++ b/multi-node-aio/playbooks/group_vars/all.yml @@ -37,7 +37,7 @@ images: image_name: "ubuntu-16.04.2-server-amd64.iso" image_short_name: "ubuntu-16.04.2-server-amd64" image_default_boot: "ubuntu-16.04.2-server-amd64/amd64/boot-screens/menu.cfg" - image_kernel_options: "biosdevname=0 net.ifnames=0 auto=true priority=critical quiet splash" + image_kernel_options: "biosdevname=0 net.ifnames=0 auto=true priority=critical" image_kernel: "ubuntu-16.04.2-server-amd64/amd64/linux" image_initrd: "ubuntu-16.04.2-server-amd64/amd64/initrd.gz" image_netboot: "ubuntu-16.04.2-server-amd64/install/netboot/ubuntu-installer" @@ -54,6 +54,9 @@ images: compute: url: "tftp://{{ tftp_server }}/preseed/compute.preseed" template_name: "compute.preseed" + infra: + url: "tftp://{{ tftp_server }}/preseed/infra.preseed" + template_name: "infra.preseed" ubuntu-14.04-amd64: image_type: debian image_iso_url: "http://releases.ubuntu.com/14.04.5/ubuntu-14.04.5-server-amd64.iso" @@ -77,7 +80,9 @@ images: compute: url: "tftp://{{ tftp_server }}/preseed/compute.preseed" template_name: "compute.preseed" - + infra: + url: "tftp://{{ tftp_server }}/preseed/infra.preseed" + template_name: "infra.preseed" # 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/host_vars/cinder1.yml b/multi-node-aio/playbooks/host_vars/cinder1.yml index cbeefa8d..6a8e0cd4 100644 --- a/multi-node-aio/playbooks/host_vars/cinder1.yml +++ b/multi-node-aio/playbooks/host_vars/cinder1.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'cinder1' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ cinder_vm_server_ram | default(2048) }}' server_vm_vcpus: 2 diff --git a/multi-node-aio/playbooks/host_vars/cinder2.yml b/multi-node-aio/playbooks/host_vars/cinder2.yml index a9ae7fec..34c72ba1 100644 --- a/multi-node-aio/playbooks/host_vars/cinder2.yml +++ b/multi-node-aio/playbooks/host_vars/cinder2.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'cinder2' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ cinder_vm_server_ram | default(2048) }}' server_vm_vcpus: 2 diff --git a/multi-node-aio/playbooks/host_vars/compute1.yml b/multi-node-aio/playbooks/host_vars/compute1.yml index 370fb2ae..48418799 100644 --- a/multi-node-aio/playbooks/host_vars/compute1.yml +++ b/multi-node-aio/playbooks/host_vars/compute1.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'compute1' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ compute_vm_server_ram | default(8192) }}' server_vm_vcpus: 4 diff --git a/multi-node-aio/playbooks/host_vars/compute2.yml b/multi-node-aio/playbooks/host_vars/compute2.yml index 4fbed840..1e2f2ab4 100644 --- a/multi-node-aio/playbooks/host_vars/compute2.yml +++ b/multi-node-aio/playbooks/host_vars/compute2.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'compute2' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ compute_vm_server_ram | default(8192) }}' server_vm_vcpus: 4 diff --git a/multi-node-aio/playbooks/host_vars/example-host1.yml.example b/multi-node-aio/playbooks/host_vars/example-host1.yml.example index 370747a0..28d63520 100644 --- a/multi-node-aio/playbooks/host_vars/example-host1.yml.example +++ b/multi-node-aio/playbooks/host_vars/example-host1.yml.example @@ -15,7 +15,8 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" # str - Set the ansible os family -server_hostname: 'example-host1' # str - required, hostname of server +server_hostname: 'host1' # str - required, hostname of server +server_domain_name: 'openstack.local' # str - required, domain name of server server_vm: true # bool - not required, used to specify a host is to become a VM server_vm_ram: 8192 # int - not required, used to specify ram when provisioning a VM server_vm_vcpus: 4 # int - not required, used to specify vcpus when provisioning a VM diff --git a/multi-node-aio/playbooks/host_vars/infra1.yml b/multi-node-aio/playbooks/host_vars/infra1.yml index 50a6fe38..1ec5245f 100644 --- a/multi-node-aio/playbooks/host_vars/infra1.yml +++ b/multi-node-aio/playbooks/host_vars/infra1.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'infra1' # str - required, hostname of server +server_domain_name: 'openstack.local' # str - required, domain name of server server_vm: true # bool - not required, used to specify a host is to become a VM server_vm_ram: '{{ infra_vm_server_ram | default(8192) }}' # int - not required, used to specify ram when provisioning a VM server_vm_vcpus: 4 # int - not required, used to specify vcpus when provisioning a VM diff --git a/multi-node-aio/playbooks/host_vars/infra2.yml b/multi-node-aio/playbooks/host_vars/infra2.yml index 46d243b5..461134ee 100644 --- a/multi-node-aio/playbooks/host_vars/infra2.yml +++ b/multi-node-aio/playbooks/host_vars/infra2.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'infra2' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ infra_vm_server_ram | default(8192) }}' server_vm_vcpus: 4 diff --git a/multi-node-aio/playbooks/host_vars/infra3.yml b/multi-node-aio/playbooks/host_vars/infra3.yml index b5c76a41..da666065 100644 --- a/multi-node-aio/playbooks/host_vars/infra3.yml +++ b/multi-node-aio/playbooks/host_vars/infra3.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'infra3' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ infra_vm_server_ram | default(8192) }}' server_vm_vcpus: 4 diff --git a/multi-node-aio/playbooks/host_vars/loadbalancer1.yml b/multi-node-aio/playbooks/host_vars/loadbalancer1.yml index 3c58a3c1..7afcff99 100644 --- a/multi-node-aio/playbooks/host_vars/loadbalancer1.yml +++ b/multi-node-aio/playbooks/host_vars/loadbalancer1.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'loadbalancer1' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ loadbalancer_vm_server_ram | default(1024) }}' server_vm_vcpus: 1 diff --git a/multi-node-aio/playbooks/host_vars/logging1.yml b/multi-node-aio/playbooks/host_vars/logging1.yml index e30f12f0..d8075f42 100644 --- a/multi-node-aio/playbooks/host_vars/logging1.yml +++ b/multi-node-aio/playbooks/host_vars/logging1.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'logging1' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ logging_vm_server_ram | default(1024) }}' server_vm_vcpus: 2 diff --git a/multi-node-aio/playbooks/host_vars/swift1.yml b/multi-node-aio/playbooks/host_vars/swift1.yml index 54366e0c..ed147ef1 100644 --- a/multi-node-aio/playbooks/host_vars/swift1.yml +++ b/multi-node-aio/playbooks/host_vars/swift1.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'swift1' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ swift_vm_server_ram | default(1024) }}' server_vm_vcpus: 2 diff --git a/multi-node-aio/playbooks/host_vars/swift2.yml b/multi-node-aio/playbooks/host_vars/swift2.yml index 29240e67..1108886c 100644 --- a/multi-node-aio/playbooks/host_vars/swift2.yml +++ b/multi-node-aio/playbooks/host_vars/swift2.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'swift2' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ swift_vm_server_ram | default(1024) }}' server_vm_vcpus: 2 diff --git a/multi-node-aio/playbooks/host_vars/swift3.yml b/multi-node-aio/playbooks/host_vars/swift3.yml index 15576483..f53130be 100644 --- a/multi-node-aio/playbooks/host_vars/swift3.yml +++ b/multi-node-aio/playbooks/host_vars/swift3.yml @@ -16,6 +16,7 @@ ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" server_hostname: 'swift3' +server_domain_name: 'openstack.local' server_vm: true server_vm_ram: '{{ swift_vm_server_ram | default(1024) }}' server_vm_vcpus: 2 diff --git a/multi-node-aio/playbooks/kvm/kvm-vm.xml b/multi-node-aio/playbooks/kvm/kvm-vm.xml index f44bcd43..d8fa35ae 100644 --- a/multi-node-aio/playbooks/kvm/kvm-vm.xml +++ b/multi-node-aio/playbooks/kvm/kvm-vm.xml @@ -52,7 +52,7 @@ {% for _key, _value in hostvars[item]['server_networks'].items()|sort(attribute='1.iface') %} {% if _key == hostvars[item]['server_vm_primary_network'] %} - + {% endif %} diff --git a/multi-node-aio/playbooks/pxe/debian/compute.preseed.j2 b/multi-node-aio/playbooks/pxe/debian/compute.preseed.j2 index e7775a69..6d8314f4 100644 --- a/multi-node-aio/playbooks/pxe/debian/compute.preseed.j2 +++ b/multi-node-aio/playbooks/pxe/debian/compute.preseed.j2 @@ -153,7 +153,7 @@ d-i partman-auto/expert_recipe string \ $lvmok{ } in_vg{ vg00 } \ lv_name{ nova00 } \ method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ + use_filesystem{ } filesystem{ xfs } \ label{ nova } \ mountpoint{ /var/lib/nova } \ . \ @@ -230,9 +230,9 @@ d-i grub-installer/bootdev string default # Post Install d-i preseed/late_command string \ - in-target bash -c "wget --no-proxy http://{{ tftp_server }}/scripts/compute-post-install-script.sh -O /opt/compute-post-install-script.sh"; \ - in-target bash -c 'chmod +x /opt/mnaio-post-install-script.sh'; \ - in-target bash -c '/opt/mnaio-post-install-script.sh' + in-target bash -c "wget --no-proxy http://{{ tftp_server }}/scripts/general-post-install-debian-script.sh -O /opt/general-post-install-script.sh"; \ + in-target bash -c 'chmod +x /opt/general-post-install-script.sh'; \ + in-target bash -c '/opt/general-post-install-script.sh' # Finish # Reboot after the install is finished. diff --git a/multi-node-aio/playbooks/pxe/debian/compute-post-install-script.sh.j2 b/multi-node-aio/playbooks/pxe/debian/general-post-install-script.sh.j2 similarity index 88% rename from multi-node-aio/playbooks/pxe/debian/compute-post-install-script.sh.j2 rename to multi-node-aio/playbooks/pxe/debian/general-post-install-script.sh.j2 index 0c571973..69726aba 100644 --- a/multi-node-aio/playbooks/pxe/debian/compute-post-install-script.sh.j2 +++ b/multi-node-aio/playbooks/pxe/debian/general-post-install-script.sh.j2 @@ -11,5 +11,5 @@ mkdir -p /root/.ssh chmod 0700 /root/.ssh echo "{{ tftp_ssh_key }}" >> /root/.ssh/authorized_keys -wget --no-proxy http://{{ tftp_server }}/networking/$(cat /etc/hostname)-bridges.cfg -O /etc/network/interfaces.d/compute-bridges.cfg +wget --no-proxy http://{{ tftp_server }}/networking/$(cat /etc/hostname)-bridges.cfg -O /etc/network/interfaces.d/general-bridges.cfg wget --no-proxy http://{{ tftp_server }}/networking/basic-debian-interface.cfg -O /etc/network/interfaces diff --git a/multi-node-aio/playbooks/pxe/debian/infra.preseed.j2 b/multi-node-aio/playbooks/pxe/debian/infra.preseed.j2 new file mode 100644 index 00000000..a509c917 --- /dev/null +++ b/multi-node-aio/playbooks/pxe/debian/infra.preseed.j2 @@ -0,0 +1,239 @@ +# Ubuntu Server Preseed +# Kernel Options + +# Use the following option to add additional boot parameters for the +# installed system (if supported by the bootloader installer). +# Note: options passed to the installer will be added automatically. +d-i debian-installer/add-kernel-opts string biosdevname=0 net.ifnames=0 elevator=cfq + +# Networking +d-i netcfg/choose_interface select eth0 +d-i netcfg/dhcp_timeout string 60 +d-i netcfg/get_hostname string host1 +d-i netcfg/get_domain string host1.openstack.local + +## USE THIS FOR STATIC NETWORKING +# d-i netcfg/disable_autoconfig boolean true +# d-i netcfg/dhcp_failed note +# d-i netcfg/dhcp_options select Configure network manually + +# # Static network configuration. +# d-i netcfg/get_ipaddress string 10.0.0.100 +# d-i netcfg/get_netmask string 255.255.255.0 +# d-i netcfg/get_gateway string 10.0.0.200 +# d-i netcfg/get_nameservers string 8.8.8.8 +# d-i netcfg/confirm_static boolean true +## USE THIS FOR STATIC NETWORKING + +# Disable that annoying WEP key dialog. +d-i netcfg/wireless_wep string + +# Pre Install + +# Command Line 1: This is necessary otherwise you will be prompted to umount /dev/vda. See Ubuntu bug #1347726. +d-i preseed/early_command string \ + umount /media || true + +# Net Image + +# Required at least for 12.10+ +d-i live-installer/net-image string {{ tftp_server }}/images/{{ item.value.image_short_name }}/install/filesystem.squashfs + +# The kernel image (meta) package to be installed; "none" can be used if no +# kernel is to be installed. +d-i base-installer/kernel/image string {{ default_ubuntu_kernel }} + +# Localization + +d-i debian-installer/locale string en +d-i debian-installer/country string US +d-i debian-installer/locale string en_US.UTF-8 +d-i debian-installer/language string en + +# Keyboard + +# Disable automatic (interactive) keymap detection. +d-i console-setup/ask_detect boolean false +d-i console-setup/layoutcode string us +d-i console-setup/variantcode string +d-i keyboard-configuration/layoutcode string us + +# Mirror + +d-i mirror/country string manual +d-i mirror/http/proxy string +d-i mirror/http/hostname string archive.ubuntu.com +d-i mirror/http/directory string /ubuntu + +# Clock and Time Zone + +# Controls whether to use NTP to set the clock during the install +d-i clock-setup/ntp boolean true +d-i clock-setup/ntp-server string ntp.ubuntu.com + +# You may set this to any valid setting for TZ; see the contents of +# /usr/share/zoneinfo/ for valid values. +d-i time/zone string US/Central + +# Controls whether or not the hardware clock is set to UTC. +d-i clock-setup/utc boolean true + +# Partitioning + +# If one of the disks that are going to be automatically partitioned +# contains an old LVM configuration, the user will normally receive a +# warning. This can be preseeded away... +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-lvm/device_remove_lvm_span boolean true +d-i partman-auto/purge_lvm_from_device boolean true + +# The same applies to pre-existing software RAID array: +d-i partman-md/device_remove_md boolean true + +# And the same goes for the confirmation to write the lvm partitions. +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +d-i partman-md/confirm boolean true +d-i partman-md/confirm_nooverwrite boolean true + +d-i partman-basicfilesystems/choose_label string gpt +d-i partman-basicfilesystems/default_label string gpt +d-i partman-partitioning/choose_label string gpt +d-i partman-partitioning/default_label string gpt +d-i partman/choose_label string gpt +d-i partman/default_label string gpt + +d-i partman-auto/method string lvm +d-i partman-auto/disk string /dev/sda + +# For LVM partitioning, you can select how much of the volume group to use +# for logical volumes. +d-i partman-auto-lvm/guided_size string max +d-i partman-auto-lvm/new_vg_name string vg00 + +d-i partman-auto/choose_recipe select custompartitioning +d-i partman-auto/expert_recipe string \ + custompartitioning :: \ + 512 1 512 ext2 \ + $primary{ } \ + $bootable{ } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext2 } \ + label{ boot } \ + mountpoint{ /boot } \ + . \ + 1024 1 100% ext4 \ + $primary{ } \ + method{ lvm } \ + device{ /dev/sda2 } \ + vg_name{ vg00 } \ + . \ + 2048 1 4096 linux-swap \ + $lvmok{ } in_vg{ vg00 } \ + lv_name{ swap00 } \ + method{ swap } format{ } \ + . \ + 8192 1 16384 ext4 \ + $lvmok{ } in_vg{ vg00 } \ + lv_name{ root00 } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + label{ root } \ + mountpoint{ / } \ + . \ + 16384 1 16384 ext4 \ + $lvmok{ } in_vg{ vg00 } \ + lv_name{ openstack00 } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + label{ openstack } \ + mountpoint{ /openstack } \ + . \ + 16384 1 10240000 ext4 \ + $lvmok{ } in_vg{ vg00 } \ + lv_name{ nova00 } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ btrfs } \ + label{ nova } \ + mountpoint{ /var/lib/machines } \ + . \ + +# This makes partman automatically partition without confirmation, provided +# that you told it what to do using one of the methods above. +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +# Packages + +# Package selection +tasksel tasksel/first multiselect openssh-server + +# Whether to upgrade packages after debootstrap. +# Allowed values: none, safe-upgrade, full-upgrade +d-i pkgsel/upgrade select full-upgrade +d-i pkgsel/include string bridge-utils \ + dstat \ + ethtool \ + git \ + htop \ + ifenslave \ + libvirt-bin \ + lvm2 \ + openssh-server \ + parted \ + python3-all \ + python-all \ + qemu-kvm \ + systemd-container \ + tmux \ + vim \ + virt-manager \ + virtinst \ + vlan + +d-i pkgsel/update-policy select none + +# Some versions of the installer can report back on what software you have +# installed, and what software you use. The default is not to report back, +# but sending reports helps the project determine what software is most +# popular and include it on CDs. +popularity-contest popularity-contest/participate boolean false + +# Users and Password + +# Skip creation of a root account (normal user account will be able to +# use sudo). The default is false; preseed this to true if you want to set +# a root password. +d-i passwd/root-login boolean true + +# Alternatively, to skip creation of a normal user account. +d-i passwd/make-user boolean false + +# The installer will warn about weak passwords. If you are sure you know +# what you're doing and want to override it, uncomment this. +d-i user-setup/allow-password-weak boolean true + +# Root password, either in clear text +d-i passwd/root-password password secrete +d-i passwd/root-password-again password secrete + +# Bootloader + +# This is fairly safe to set, it makes grub install automatically to the MBR +# if no other operating system is detected on the machine. +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean true +d-i grub-installer/bootdev string default + +# Post Install + +d-i preseed/late_command string \ + in-target bash -c "wget --no-proxy http://{{ tftp_server }}/scripts/general-post-install-debian-script.sh -O /opt/general-post-install-script.sh"; \ + in-target bash -c 'chmod +x /opt/general-post-install-script.sh'; \ + in-target bash -c '/opt/general-post-install-script.sh' +# Finish + +# Reboot after the install is finished. +d-i finish-install/reboot_in_progress note diff --git a/multi-node-aio/playbooks/mnaio/debian/mnaio-bridges.cfg.j2 b/multi-node-aio/playbooks/pxe/debian/mnaio-bridges.cfg.j2 similarity index 100% rename from multi-node-aio/playbooks/mnaio/debian/mnaio-bridges.cfg.j2 rename to multi-node-aio/playbooks/pxe/debian/mnaio-bridges.cfg.j2 diff --git a/multi-node-aio/playbooks/mnaio/debian/mnaio-post-install-script.sh.j2 b/multi-node-aio/playbooks/pxe/debian/mnaio-post-install-script.sh.j2 similarity index 100% rename from multi-node-aio/playbooks/mnaio/debian/mnaio-post-install-script.sh.j2 rename to multi-node-aio/playbooks/pxe/debian/mnaio-post-install-script.sh.j2 diff --git a/multi-node-aio/playbooks/pxe/debian/mnaio.preseed.j2 b/multi-node-aio/playbooks/pxe/debian/mnaio.preseed.j2 index 27c8114e..3a08eb1f 100644 --- a/multi-node-aio/playbooks/pxe/debian/mnaio.preseed.j2 +++ b/multi-node-aio/playbooks/pxe/debian/mnaio.preseed.j2 @@ -229,7 +229,7 @@ d-i grub-installer/bootdev string default # Post Install d-i preseed/late_command string \ - in-target bash -c "wget --no-proxy http://{{ tftp_server }}/scripts/mnaio-post-install-script.sh -O /opt/mnaio-post-install-script.sh"; \ + in-target bash -c "wget --no-proxy http://{{ tftp_server }}/scripts/mnaio-post-install-debian-script.sh -O /opt/mnaio-post-install-script.sh"; \ in-target bash -c 'chmod +x /opt/mnaio-post-install-script.sh'; \ in-target bash -c '/opt/mnaio-post-install-script.sh' # Finish diff --git a/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.macaddr.j2 b/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.macaddr.j2 index ef52dfaf..24cfe4e2 100644 --- a/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.macaddr.j2 +++ b/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.macaddr.j2 @@ -7,5 +7,5 @@ timeout 1 label linux kernel {{ image_properties['image_kernel'] }} {% if image_properties['image_type'] == 'debian' %} - append hostname={{ server_vars['server_hostname'] }} {{ image_properties['image_kernel_options'] }} initrd={{ image_properties['image_initrd'] }} preseed/url={{ image_properties['image_preseeds'][server_vars['server_preseed_ks']]['url'] }} preseed/interactive=false netcfg/choose_interface={{ server_vars['server_default_interface'] }} {{ server_vars['server_extra_options'] | default('') }} + append hostname={{ server_vars['server_hostname'] }} {{ image_properties['image_kernel_options'] }} initrd={{ image_properties['image_initrd'] }} preseed/url={{ image_properties['image_preseeds'][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'] }} {{ server_vars['server_extra_options'] | default('') }} {% endif %} diff --git a/multi-node-aio/playbooks/setup-host.yml b/multi-node-aio/playbooks/setup-host.yml index 7fa3b980..99ac8fe8 100644 --- a/multi-node-aio/playbooks/setup-host.yml +++ b/multi-node-aio/playbooks/setup-host.yml @@ -129,7 +129,7 @@ - name: Drop host network interfaces template: - src: "mnaio/{{ ansible_os_family | lower }}/mnaio-bridges.cfg.j2" + src: "pxe/{{ ansible_os_family | lower }}/mnaio-bridges.cfg.j2" dest: /etc/network/interfaces.d/mnaio-bridges.cfg mode: "0644" owner: root @@ -230,67 +230,7 @@ fi done - - name: Install repo caching server packages - package: - name: "{{ item }}" - state: "latest" - with_items: "{{ mnaio_pkg_cache_server_distro_packages }}" - - - name: Create cache directory - file: - path: "/var/www/pkg-cache" - state: "directory" - owner: "apt-cacher-ng" - group: "www-data" - mode: "02775" - - - name: Stat the cache path - stat: - path: /var/cache/apt-cacher-ng - register: acs - - - name: Remove cacher directory if its a directory - file: - path: "/var/cache/apt-cacher-ng" - state: "absent" - when: - - acs.stat.isdir is defined and acs.stat.isdir - - - name: Link cacher to the repo path - file: - src: "/var/www/pkg-cache" - dest: "/var/cache/apt-cacher-ng" - state: "link" - - - name: create yum merged mirror list - shell: | - curl https://www.centos.org/download/full-mirrorlist.csv | sed 's/^.*"http:/http:/' | sed 's/".*$//' | grep ^http >/etc/apt-cacher-ng/centos_mirrors - echo "http://mirror.centos.org/centos/" >>/etc/apt-cacher-ng/centos_mirrors - - - name: Drop acng.conf - template: - src: "pxe/acng.conf.j2" - dest: "/etc/apt-cacher-ng/acng.conf" - notify: - - reload acng - - - name: Drop apt package manager proxy - copy: - content: 'Acquire::http { Proxy "{{ default_ubuntu_mirror_proxy }}"; };' - dest: "/etc/apt/apt.conf.d/00apt-cacher-proxy" - - - name: Update apt when proxy is added - apt: - update_cache: yes - environment: "{{ deployment_environment_variables | default({}) }}" - handlers: - - name: reload acng - service: - name: "apt-cacher-ng" - state: restarted - enabled: yes - tags: - setup-host diff --git a/multi-node-aio/playbooks/site.yml b/multi-node-aio/playbooks/site.yml index c5d33b48..dffc83dd 100644 --- a/multi-node-aio/playbooks/site.yml +++ b/multi-node-aio/playbooks/site.yml @@ -17,6 +17,10 @@ when: - setup_host | default(true) | bool +- include: deploy-acng.yml + when: + - setup_pxeboot | default(true) | bool + - include: deploy-pxe.yml when: - setup_pxeboot | default(true) | bool