Skip to content

Commit

Permalink
Version 3.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbojko committed May 23, 2024
1 parent 22f413e commit 0ca2b8f
Show file tree
Hide file tree
Showing 53 changed files with 1,428 additions and 1,133 deletions.
505 changes: 191 additions & 314 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## Version 3.0.2 2024-05-23

Codename: Defying Gravity - [https://www.youtube.com/watch?v=l0Bs_eaXaCo](https://www.youtube.com/watch?v=l0Bs_eaXaCo)

* [ANSIBLE] - permanent removal variables from playbook
* install_zabbix: false # install Zabbix-agent
* install_zabbix_as_root: false # install Zabbix-agent as root
* install_puppet: true # Install Puppet
* install_kubernetes_workaround: false # add `cgroup.memory=nokmem` to grub
* [ANSIBLE] - change playbook version to 20240404
* [ANSIBLE] - removed `systemd.unified_cgroup_hierarchy` for RHEL anc clones above 8 as this is set by default in OS
* [AlmaLinux] - added support for AlmaLinux 9.4
* [OracleLinux] - added support for Oracle Linux 9.4
* [RockyLinux] - added support for Rocky Linux 9.4
* [Ubuntu] - added support for Ubuntu 22.04

## Version 3.0.1 2023-12-08

Codename: Slip Away - [https://www.youtube.com/watch?v=G8g_7CDwbmI](https://www.youtube.com/watch?v=G8g_7CDwbmI)
Expand Down
67 changes: 20 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Set of Hashicorp's `Packer` templates to create Microsoft Hyper-V virtual machines
# Set of Hashicorp's `Packer's` templates to create Microsoft Hyper-V virtual machines

![RockyLinux](https://img.shields.io/badge/Linux-Rocky-brightgreen)
![OracleLinux](https://img.shields.io/badge/Linux-Oracle-brightgreen)
Expand All @@ -13,7 +13,7 @@ Consider buying me a coffee if you like my work. All donations are appreciated.

<!-- TOC -->

- [Set of Hashicorp's Packer templates to create Microsoft Hyper-V virtual machines](#set-of-hashicorps-packer-templates-to-create-microsoft-hyper-v-virtual-machines)
- [Set of Hashicorp's Packer's templates to create Microsoft Hyper-V virtual machines](#set-of-hashicorps-packers-templates-to-create-microsoft-hyper-v-virtual-machines)
- [Requirements](#requirements)
- [Requirements - Quick Start](#requirements---quick-start)
- [Install packer from Chocolatey](#install-packer-from-chocolatey)
Expand Down Expand Up @@ -50,13 +50,14 @@ Consider buying me a coffee if you like my work. All donations are appreciated.
- [I have problem how to find a proper WIM name in Windows ISO to pick proper version](#i-have-problem-how-to-find-a-proper-wim--name-in-windows-iso-to-pick-proper-version)
- [On Windows machines, build break during updates phase, when update cycles are interfering with each other](#on-windows-machines-build-break-during-updates-phase-when-update-cycles-are-interfering-with-each-other)
- [Why don't you use ansible instead of shell scripts for provisioning](#why-dont-you-use-ansible-instead-of-shell-scripts-for-provisioning)
- [Support me](#support-me)
- [About](#about)

<!-- /TOC -->

## Requirements

- packer <=`1.9.1`. Do not use packer below 1.7.0 version. For previous packer versions use previous releases from this repository
- packer >=`1.10.0`. Do not use packer below 1.7.0 version. For previous packer versions use previous releases from this repository
- Microsoft Hyper-V Server 2016/2019 or Microsoft Windows Server 2016/2019 (not 2012/R2) with Hyper-V role installed as host to build your images
- firewall exceptions for `packer` http server (look down below)
- [OPTIONAL] Vagrant >= `2.3.4` - for `vagrant` version of scripts. Boxes (prebuilt) are already available here: [https://app.vagrantup.com/marcinbojko](https://app.vagrantup.com/marcinbojko)
Expand All @@ -68,7 +69,7 @@ Consider buying me a coffee if you like my work. All donations are appreciated.
### Install packer from Chocolatey

```cmd
choco install packer --version=1.9.1 -y
choco install packer --version=1.10.0 -y
```

### Install required plugins
Expand Down Expand Up @@ -114,7 +115,6 @@ switch_name = "vSwitch"
|Windows|Administrator|password|
|CentOS/RHEL|root|password|
|Ubuntu|ubuntu|password|
|||

## Scripts

Expand All @@ -130,41 +130,17 @@ switch_name = "vSwitch"
|sysinternals|latest|Mandatory|
|tabby|latest|Optional|

- `phase3.ps1` Puppet agent settings will be customized (`server=foreman.example.com`) with parameters:
- `Version` - puppet chocolatey version, for example "6.26.0"
- `AddPrivateChoco` ($true/$false) - if set to true, private MyGet repository will be added as `public`
- `PuppetMaster` (foreman.example.com) - if set, in `puppet.conf` section server will point to that variable

Example of usage:

`.\phase3.ps1 -Version 7.14.0 -AddPrivateChoco $true -PuppetMaster foreman.example.com`

Puppet is set to clear any temp SSL keys and to be stopped after generalize phase

- `phase5b-docker.ps1` - Docker settings can be customised
- `requiredVersion` - which version of docker module to install - defaults to 19.03.1
- `installCompose` ($true/$false) - install docker-compose from chocolatey packages
- `dockerLocation` - of set, will default docker images and settings there. On empty, docker location is not being set.
- `configDockerLocation` - default place for docker's config file

Example of usage

`.\phase5b-docker.ps1 -requiredVersion "19.03.1" -installCompose $true -dockerLocation "d:\docker" -configDockerLocation "C:\ProgramData\Docker\config"`

### Linux Machines

- Repositories:

|Repository|Package|switch|default
|Repository|Package|switch|default|
|----------|------------|---|---|
|Epel 7/8/9|epel-release|can be switched off by setting "install_epel" to `false`|true|
|Zabbix 6.0|zabbix-agent|can be switched on by setting "install_zabbix" to `true`|false|
|Puppet 7 |puppet-agent|can be switched off by setting "install_puppet" to false|false|
|Webmin |webmin|can be switched on by setting "install_webmin" to `false`|false|
|Cockpit |cockpit|can be switched on by setting "install_zabbix" to `true`|true|
|Hyper-V |SCVMM Agent|can be switched off by setting "install_hyperv" to `false`|true|
|Neofetch |neofetch|can be switched off by setting "install_neofetch" to `false`|true|
||||

Be aware, turning off latest System Center Virtual Machine Agent will cause System Center fail to deploy machines

Expand All @@ -179,13 +155,8 @@ Playbooks are held in `/extra/playbooks` folder, with proper OS variables.
install_epel: true # install Epel
install_webmin: true # install Webmin
install_hyperv: true # install Hyper-v and scvmm agent
install_zabbix: false # install Zabbix-agent
install_zabbix_as_root: false # install Zabbix-agent as root
install_cockpit: false # install Cockpit
install_puppet: true # Install Puppet
install_docker_workaround: true # add `fsck.repair=yes` to grub
install_kubernetes_workaround: false # add `cgroup.memory=nokmem` to grub
remove_puppet_ssl_keys: false # remove any ssl keys after puppet installation
install_neofetch: true # install neofetch
install_updates: true # install updates
install_extra_groups: true # install extra groups
Expand Down Expand Up @@ -261,42 +232,42 @@ Example for Windows 2022 Datacenter

|Action|Version|Template|Log|OS|
|-------|-------|--------|---|-|
|`build`|almalinux-8.8|rhel|0/1|Alma Linux 8.8|
|`build`|almalinux-9.2|rhel|0/1|Alma Linux 9.2|
|`build`|almalinux-8.9|rhel|0/1|Alma Linux 8.9|
|`build`|almalinux-9.4|rhel|0/1|Alma Linux 9.4|

#### Examples for AlmaLinux

```powershell
.\hv_generic.ps1 -Action build -Version almalinux-8.8 -Template rhel -Log 0
.\hv_generic.ps1 -Action build -Version almalinux-9.2 -Template rhel -Log 0
.\hv_generic.ps1 -Action build -Version almalinux-8.9 -Template rhel -Log 0
.\hv_generic.ps1 -Action build -Version almalinux-9.4 -Template rhel -Log 0
```

### Building RockyLinux Machines

|Action|Version|Template|Log|OS|
|-------|-------|--------|---|-|
|`build`|rockylinux-8.8|rhel|0/1|Rocky Linux 8.8|
|`build`|rockyinux-9.2|rhel|0/1|Rocky Linux 9.2|
|`build`|rockylinux-8.9|rhel|0/1|Rocky Linux 8.9|
|`build`|rockyinux-9.4|rhel|0/1|Rocky Linux 9.4|

#### Examples for RockyLinux

```powershell
.\hv_generic.ps1 -Action build -Version rockylinux-8.8 -Template rhel -Log 0
.\hv_generic.ps1 -Action build -Version rockylinux-9.2 -Template rhel -Log 0
.\hv_generic.ps1 -Action build -Version rockylinux-8.9 -Template rhel -Log 0
.\hv_generic.ps1 -Action build -Version rockylinux-9.4 -Template rhel -Log 0
```

### Building OracleLinux Machines

|Action|Version|Template|Log|OS|
|-------|-------|--------|---|-|
|`build`|oraclelinux-8.8|rhel|0/1|Oracle Linux 8.8|
|`build`|oraclelinux-9.2|rhel|0/1|Oracle Linux 9.2|
|`build`|oraclelinux-8.9|rhel|0/1|Oracle Linux 8.9|
|`build`|oraclelinux-9.4|rhel|0/1|Oracle Linux 9.4|

#### Examples for OracleLinux

```powershell
.\hv_generic.ps1 -Action build -Version oraclelinux-8.8 -Template rhel -Log 0
.\hv_generic.ps1 -Action build -Version oraclelinux-9.2 -Template rhel -Log 0
.\hv_generic.ps1 -Action build -Version oraclelinux-8.9 -Template rhel -Log 0
.\hv_generic.ps1 -Action build -Version oraclelinux-9.4 -Template rhel -Log 0
```

### Building Ubuntu Machines
Expand All @@ -305,12 +276,14 @@ Example for Windows 2022 Datacenter
|-------|-------|--------|---|-|
|`build`|ubuntu-20.04|ubuntu|0/1|Ubuntu 20.04|
|`build`|ubuntu-22.04|ubuntu|0/1|Ubuntu 22.04|
|`build`|ubuntu-24.04|ubuntu|0/1|Ubuntu 24.04|

#### Examples for Ubuntu

```powershell
.\hv_generic.ps1 -Action build -Version ubuntu-20.04 -Template ubuntu -Log 0
.\hv_generic.ps1 -Action build -Version ubuntu-22.04 -Template ubuntu -Log 0
.\hv_generic.ps1 -Action build -Version ubuntu-24.04 -Template ubuntu -Log 0
```

## Known issues
Expand Down
9 changes: 0 additions & 9 deletions extra/.ansible-lint

This file was deleted.

11 changes: 0 additions & 11 deletions extra/.yamllint

This file was deleted.

101 changes: 101 additions & 0 deletions extra/files/almalinux/8/virtualbox/ks.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#version=RHEL8
# X Window System configuration information
# License agreement
eula --agreed
# Use graphical install
text
# SELinux configuration
selinux --disabled
# Network information
network --bootproto=dhcp --noipv6 --activate
# Use CDROM installation media
cdrom
# Run the Setup Agent on first boot
firstboot --disable
# System services
services --enabled="chronyd"
services --enabled="sshd"
services --enabled="NetworkManager"

# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US --addsupport=en_GB.UTF-8

repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
# Root password
rootpw --plaintext password
# System timezone
timezone UTC --isUtc --ntpservers=0.rhel.pool.ntp.org
# System bootloader configuration
bootloader --location=mbr
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot/efi --fstype="vfat" --size=400
part /boot --fstype="ext4" --size=2048
part swap --fstype="swap" --size=8192
part / --fstype="ext4" --grow --size=1

%packages
@guest-agents
@legacy-unix
@system-tools
mc
curl
wget
tar
bzip2
kernel-devel
kernel-headers
perl
gcc
git
make
elfutils-libelf-devel
langpacks-en
glibc-all-langpacks
openssh-server
openssh-clients
openssh
tuned
tuned-profiles-atomic
qemu-guest-agent
python3-pip
python3-setuptools
spice-vdagent
qemu-guest-agent
cloud-init
cloud-utils-growpart
%end

%addon com_redhat_subscription_manager
%end
%addon ADDON_placeholder --disable --reserve-mb=auto
%end
%addon com_redhat_kdump --disable
%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

# post part
%post --log=/var/log/anaconda/kickstart_post_sshd.log
sed -ri 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -ri 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -ri 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
systemctl enable sshd --now
%end

%post --log=/var/log/anaconda/kickstart_post.log
systemctl enable sshd --now
systemctl enable qemu-guest-agent
systemctl set-default multi-user.target
%end

#reboot
reboot
Loading

0 comments on commit 0ca2b8f

Please sign in to comment.