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 <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2017-10-13 18:53:56 -05:00
parent 835c2632f2
commit 2f503c228e
No known key found for this signature in database
GPG Key ID: 69FEFFC5E2D9273F
27 changed files with 383 additions and 78 deletions

View File

@ -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

View File

@ -196,13 +196,13 @@
- src: vm-post-install-script.sh.j2 - src: vm-post-install-script.sh.j2
dest: "vm-post-install-{{ ansible_os_family | lower }}-script.sh" dest: "vm-post-install-{{ ansible_os_family | lower }}-script.sh"
dir: scripts dir: scripts
- src: compute-post-install-script.sh.j2 - src: general-post-install-script.sh.j2
dest: "compute-post-install-{{ ansible_os_family | lower }}-script.sh" dest: "general-post-install-{{ ansible_os_family | lower }}-script.sh"
dir: scripts dir: scripts
- name: network scripts for an MNAIO - name: network scripts for an MNAIO
template: 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 }} dest: /var/www/pxe/{{ item.dir }}/{{ item.dest }}
mode: "0644" mode: "0644"
owner: root owner: root
@ -214,7 +214,7 @@
dest: mnaio-bridges.cfg dest: mnaio-bridges.cfg
dir: networking dir: networking
- src: mnaio-post-install-script.sh.j2 - 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 dir: scripts
- name: network scripts for servers - name: network scripts for servers
@ -229,7 +229,7 @@
- name: tftp configs for servers - name: tftp configs for servers
template: template:
src: "pxe/tftp/pxelinux.cfg.macaddr.j2" 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" mode: "0644"
owner: root owner: root
group: root group: root
@ -271,6 +271,15 @@
group: root group: root
with_dict: "{{ images }}" 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 - name: Create netboot bind mount path
file: file:
path: "/var/lib/tftpboot/{{ item.value.image_short_name }}" path: "/var/lib/tftpboot/{{ item.value.image_short_name }}"

View File

@ -39,7 +39,7 @@ shared-network all-networks {
group { group {
{% for item in groups['pxe_servers'] %} {% for item in groups['pxe_servers'] %}
host {{ hostvars[item]['server_hostname'] }} { 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'] }}; fixed-address {{ hostvars[item]['server_vm_fixed_addr'] }};
option host-name "{{ hostvars[item]['server_hostname'] }}"; option host-name "{{ hostvars[item]['server_hostname'] }}";
} }

View File

@ -37,7 +37,7 @@ images:
image_name: "ubuntu-16.04.2-server-amd64.iso" image_name: "ubuntu-16.04.2-server-amd64.iso"
image_short_name: "ubuntu-16.04.2-server-amd64" image_short_name: "ubuntu-16.04.2-server-amd64"
image_default_boot: "ubuntu-16.04.2-server-amd64/amd64/boot-screens/menu.cfg" 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_kernel: "ubuntu-16.04.2-server-amd64/amd64/linux"
image_initrd: "ubuntu-16.04.2-server-amd64/amd64/initrd.gz" image_initrd: "ubuntu-16.04.2-server-amd64/amd64/initrd.gz"
image_netboot: "ubuntu-16.04.2-server-amd64/install/netboot/ubuntu-installer" image_netboot: "ubuntu-16.04.2-server-amd64/install/netboot/ubuntu-installer"
@ -54,6 +54,9 @@ images:
compute: compute:
url: "tftp://{{ tftp_server }}/preseed/compute.preseed" url: "tftp://{{ tftp_server }}/preseed/compute.preseed"
template_name: "compute.preseed" template_name: "compute.preseed"
infra:
url: "tftp://{{ tftp_server }}/preseed/infra.preseed"
template_name: "infra.preseed"
ubuntu-14.04-amd64: ubuntu-14.04-amd64:
image_type: debian image_type: debian
image_iso_url: "http://releases.ubuntu.com/14.04.5/ubuntu-14.04.5-server-amd64.iso" image_iso_url: "http://releases.ubuntu.com/14.04.5/ubuntu-14.04.5-server-amd64.iso"
@ -77,7 +80,9 @@ images:
compute: compute:
url: "tftp://{{ tftp_server }}/preseed/compute.preseed" url: "tftp://{{ tftp_server }}/preseed/compute.preseed"
template_name: "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 # 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. # is defined the largest unpartitioned disk will be used.
mnaio_host_networks: mnaio_host_networks:

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'cinder1' server_hostname: 'cinder1'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ cinder_vm_server_ram | default(2048) }}' server_vm_ram: '{{ cinder_vm_server_ram | default(2048) }}'
server_vm_vcpus: 2 server_vm_vcpus: 2

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'cinder2' server_hostname: 'cinder2'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ cinder_vm_server_ram | default(2048) }}' server_vm_ram: '{{ cinder_vm_server_ram | default(2048) }}'
server_vm_vcpus: 2 server_vm_vcpus: 2

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'compute1' server_hostname: 'compute1'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ compute_vm_server_ram | default(8192) }}' server_vm_ram: '{{ compute_vm_server_ram | default(8192) }}'
server_vm_vcpus: 4 server_vm_vcpus: 4

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'compute2' server_hostname: 'compute2'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ compute_vm_server_ram | default(8192) }}' server_vm_ram: '{{ compute_vm_server_ram | default(8192) }}'
server_vm_vcpus: 4 server_vm_vcpus: 4

View File

@ -15,7 +15,8 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" # str - Set the ansible os family 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: 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_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 server_vm_vcpus: 4 # int - not required, used to specify vcpus when provisioning a VM

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'infra1' # str - required, hostname of server 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: 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_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 server_vm_vcpus: 4 # int - not required, used to specify vcpus when provisioning a VM

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'infra2' server_hostname: 'infra2'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ infra_vm_server_ram | default(8192) }}' server_vm_ram: '{{ infra_vm_server_ram | default(8192) }}'
server_vm_vcpus: 4 server_vm_vcpus: 4

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'infra3' server_hostname: 'infra3'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ infra_vm_server_ram | default(8192) }}' server_vm_ram: '{{ infra_vm_server_ram | default(8192) }}'
server_vm_vcpus: 4 server_vm_vcpus: 4

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'loadbalancer1' server_hostname: 'loadbalancer1'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ loadbalancer_vm_server_ram | default(1024) }}' server_vm_ram: '{{ loadbalancer_vm_server_ram | default(1024) }}'
server_vm_vcpus: 1 server_vm_vcpus: 1

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'logging1' server_hostname: 'logging1'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ logging_vm_server_ram | default(1024) }}' server_vm_ram: '{{ logging_vm_server_ram | default(1024) }}'
server_vm_vcpus: 2 server_vm_vcpus: 2

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'swift1' server_hostname: 'swift1'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ swift_vm_server_ram | default(1024) }}' server_vm_ram: '{{ swift_vm_server_ram | default(1024) }}'
server_vm_vcpus: 2 server_vm_vcpus: 2

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'swift2' server_hostname: 'swift2'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ swift_vm_server_ram | default(1024) }}' server_vm_ram: '{{ swift_vm_server_ram | default(1024) }}'
server_vm_vcpus: 2 server_vm_vcpus: 2

View File

@ -16,6 +16,7 @@
ansible_os_family: "{{ images[default_vm_image]['image_type'] }}" ansible_os_family: "{{ images[default_vm_image]['image_type'] }}"
server_hostname: 'swift3' server_hostname: 'swift3'
server_domain_name: 'openstack.local'
server_vm: true server_vm: true
server_vm_ram: '{{ swift_vm_server_ram | default(1024) }}' server_vm_ram: '{{ swift_vm_server_ram | default(1024) }}'
server_vm_vcpus: 2 server_vm_vcpus: 2

View File

@ -52,7 +52,7 @@
{% for _key, _value in hostvars[item]['server_networks'].items()|sort(attribute='1.iface') %} {% for _key, _value in hostvars[item]['server_networks'].items()|sort(attribute='1.iface') %}
<interface type='network'> <interface type='network'>
{% if _key == hostvars[item]['server_vm_primary_network'] %} {% if _key == hostvars[item]['server_vm_primary_network'] %}
<mac address='{{ hostvars[item]["server_mac_address"] }}'/> <mac address='{{ hostvars[item]["server_mac_address"] | lower }}'/>
<boot order='2'/> <boot order='2'/>
{% endif %} {% endif %}
<source network='{{ _value.vm_int_iface }}'/> <source network='{{ _value.vm_int_iface }}'/>

View File

@ -153,7 +153,7 @@ d-i partman-auto/expert_recipe string \
$lvmok{ } in_vg{ vg00 } \ $lvmok{ } in_vg{ vg00 } \
lv_name{ nova00 } \ lv_name{ nova00 } \
method{ format } format{ } \ method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \ use_filesystem{ } filesystem{ xfs } \
label{ nova } \ label{ nova } \
mountpoint{ /var/lib/nova } \ mountpoint{ /var/lib/nova } \
. \ . \
@ -230,9 +230,9 @@ d-i grub-installer/bootdev string default
# Post Install # Post Install
d-i preseed/late_command string \ 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 "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/mnaio-post-install-script.sh'; \ in-target bash -c 'chmod +x /opt/general-post-install-script.sh'; \
in-target bash -c '/opt/mnaio-post-install-script.sh' in-target bash -c '/opt/general-post-install-script.sh'
# Finish # Finish
# Reboot after the install is finished. # Reboot after the install is finished.

View File

@ -11,5 +11,5 @@ mkdir -p /root/.ssh
chmod 0700 /root/.ssh chmod 0700 /root/.ssh
echo "{{ tftp_ssh_key }}" >> /root/.ssh/authorized_keys 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 wget --no-proxy http://{{ tftp_server }}/networking/basic-debian-interface.cfg -O /etc/network/interfaces

View File

@ -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

View File

@ -229,7 +229,7 @@ d-i grub-installer/bootdev string default
# Post Install # Post Install
d-i preseed/late_command string \ 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 'chmod +x /opt/mnaio-post-install-script.sh'; \
in-target bash -c '/opt/mnaio-post-install-script.sh' in-target bash -c '/opt/mnaio-post-install-script.sh'
# Finish # Finish

View File

@ -7,5 +7,5 @@ timeout 1
label linux label linux
kernel {{ image_properties['image_kernel'] }} kernel {{ image_properties['image_kernel'] }}
{% if image_properties['image_type'] == 'debian' %} {% 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 %} {% endif %}

View File

@ -129,7 +129,7 @@
- name: Drop host network interfaces - name: Drop host network interfaces
template: 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 dest: /etc/network/interfaces.d/mnaio-bridges.cfg
mode: "0644" mode: "0644"
owner: root owner: root
@ -230,67 +230,7 @@
fi fi
done 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({}) }}" environment: "{{ deployment_environment_variables | default({}) }}"
handlers:
- name: reload acng
service:
name: "apt-cacher-ng"
state: restarted
enabled: yes
tags: tags:
- setup-host - setup-host

View File

@ -17,6 +17,10 @@
when: when:
- setup_host | default(true) | bool - setup_host | default(true) | bool
- include: deploy-acng.yml
when:
- setup_pxeboot | default(true) | bool
- include: deploy-pxe.yml - include: deploy-pxe.yml
when: when:
- setup_pxeboot | default(true) | bool - setup_pxeboot | default(true) | bool