Skip to content

Commit

Permalink
Version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbojko committed Nov 13, 2022
1 parent c96da45 commit c1ea2fe
Show file tree
Hide file tree
Showing 45 changed files with 1,499 additions and 422 deletions.
8 changes: 2 additions & 6 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
skip_list:
- package-latest
- command-instead-of-shell
- no-handler
- risky-file-permissions
- risky-shell-pipe
- no-relative-paths
- experimental
- experimental
- name[casing]
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.sh text eol=lf
*.cfg text eol=lf
install text eol=lf
*.ps1 text eol=crlf
128 changes: 106 additions & 22 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
variables:
packer_version: "1.8.2"
packer_version: "1.8.4"
dind: 20.10-dind
build_alma: "false"
build_centos: "false"
build_rocky: "false"
build_rocky8: "false"
build_rocky9: "false"
build_oracle: "false"
build_ubuntu2004: "false"
build_ubuntu2204: "false"
Expand All @@ -14,33 +15,32 @@ stages:
- centos7-validate
- alma8-validate
- rocky8-validate
- rocky9-validate
- oracle8-validate
- ubuntu20-validate
- windows2019-validate
- windows2022-validate
- ansible-lint
- install_packer
- build_alma
- build_rocky
- build_rocky8
- build_rocky9
- build_centos
- build_oracle
- build_ubuntu
- build_windows2022
get-packer:
stage: get-packer
image: alpine
image: hashicorp/packer:${packer_version}
services:
- docker:$dind
artifacts:
expire_in: 1d
paths:
- packer
script:
- echo "Fetching packer"
- wget https://releases.hashicorp.com/packer/"$packer_version"/packer_"$packer_version"_linux_amd64.zip
- unzip packer_"$packer_version"_linux_amd64.zip
- chmod +x packer
- rm -rf packer_"$packer_version"_linux_amd64.zip
- pwd
- cp -p /bin/packer ./packer
tags:
- docker
- packer
Expand Down Expand Up @@ -140,7 +140,7 @@ alma8-docker:
- packer
needs:
- get-packer
# Rocky
# Rocky 8
rocky8:
stage: rocky8-validate
image: alpine
Expand Down Expand Up @@ -189,6 +189,39 @@ rocky8-docker:
- packer
needs:
- get-packer
# Rocky 9
rocky9:
stage: rocky9-validate
image: alpine
services:
- docker:$dind
before_script:
- export template_file="./templates/hv_rockylinux9_g2.pkr.hcl"
- export var_file="./variables/variables_rockylinux9.pkvars.hcl"
script:
- ./packer version --version
- ./packer validate -var-file="$var_file" "$template_file"
tags:
- docker
- packer
needs:
- get-packer
rocky9-docker:
stage: rocky9-validate
image: alpine
services:
- docker:$dind
before_script:
- export template_file="./templates/hv_rockylinux9_g2_docker.pkr.hcl"
- export var_file="./variables/variables_rockylinux9.pkvars.hcl"
script:
- ./packer version --version
- ./packer validate -var-file="$var_file" "$template_file"
tags:
- docker
- packer
needs:
- get-packer
# Validate Oracle
oracle8:
stage: oracle8-validate
Expand Down Expand Up @@ -401,7 +434,8 @@ lts2022-dc-vagrant:
- get-packer
ansible-lint:
stage: ansible-lint
image: marcinbojko/pipetools-ansible
image: ${PIPELINE_IMAGE}:${PIPELINE_IMAGE_TAG}
allow_failure: true
services:
- docker:$dind
before_script:
Expand Down Expand Up @@ -484,8 +518,8 @@ build_alma_vagrant:
needs:
- build_alma_docker
# Rocky
build_rocky:
stage: build_rocky
build_rocky8:
stage: build_rocky8
script:
- pwd
- '$env:PACKER_CACHE_DIR="e:\packer_cache"'
Expand All @@ -494,13 +528,13 @@ build_rocky:
- "Get-Vm -name packer-*|Remove-VM -Force"
- .\hv_rockylinux86.ps1
rules:
- if: $build_rocky == "true"
- if: $build_rocky8 == "true"
when: on_success
tags:
- windows
- hyperv
build_rocky_docker:
stage: build_rocky
build_rocky8_docker:
stage: build_rocky8
script:
- pwd
- '$env:PACKER_CACHE_DIR="e:\packer_cache"'
Expand All @@ -509,15 +543,15 @@ build_rocky_docker:
- "Get-Vm -name packer-*|Remove-VM -Force"
- .\hv_rockylinux86_docker.ps1
rules:
- if: $build_rocky == "true"
- if: $build_rocky8 == "true"
when: on_success
tags:
- windows
- hyperv
needs:
- build_rocky
build_rocky_vagrant:
stage: build_rocky
- build_rocky8
build_rocky8_vagrant:
stage: build_rocky8
script:
- pwd
- '$env:PACKER_CACHE_DIR="e:\packer_cache"'
Expand All @@ -526,13 +560,63 @@ build_rocky_vagrant:
- "Get-Vm -name packer-*|Remove-VM -Force"
- .\hv_rockylinux86_vagrant.ps1
rules:
- if: $build_rocky == "true"
- if: $build_rocky8 == "true"
when: on_success
tags:
- windows
- hyperv
needs:
- build_rocky8_docker
# Rocky 9
build_rocky9:
stage: build_rocky9
script:
- pwd
- '$env:PACKER_CACHE_DIR="e:\packer_cache"'
- "Get-Vm -name packer-*|Stop-VM -Force"
- Sleep 120
- "Get-Vm -name packer-*|Remove-VM -Force"
- .\hv_rockylinux9.ps1
rules:
- if: $build_rocky9 == "true"
when: on_success
tags:
- windows
- hyperv
build_rocky9_docker:
stage: build_rocky9
script:
- pwd
- '$env:PACKER_CACHE_DIR="e:\packer_cache"'
- "Get-Vm -name packer-*|Stop-VM -Force"
- Sleep 120
- "Get-Vm -name packer-*|Remove-VM -Force"
- .\hv_rockylinux9_docker.ps1
rules:
- if: $build_rocky9 == "true"
when: on_success
tags:
- windows
- hyperv
needs:
- build_rocky9
build_rocky9_vagrant:
stage: build_rocky9
script:
- pwd
- '$env:PACKER_CACHE_DIR="e:\packer_cache"'
- "Get-Vm -name packer-*|Stop-VM -Force"
- Sleep 120
- "Get-Vm -name packer-*|Remove-VM -Force"
- .\hv_rockylinux9_vagrant.ps1
rules:
- if: $build_rocky9 == "true"
when: on_success
tags:
- windows
- hyperv
needs:
- build_rocky_docker
- build_rocky9_docker
# Build Oracle
build_oracle:
stage: build_oracle
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## Version 2.0.0 2022-11-13

* [BREAKING_CHANGE] Puppet repositories and puppet agent no longer is being installed by default. To change this behavior adjust vatiables for ansible playbooks in /variables/{distro-name}.yaml files
* [BREAKING_CHANGE] System Center 2019 agent doesn't support RHEL 9/Rocky Linux 9 - instalation fails
* [BREAKING_CHANGE] removal of all Windows SAC deployments - this repo will no longer support these editions
* [Extra] `extra` scripts and playbooks optimizations
* [RockyLinux] added `RockyLinux 9.0` support
* [RockyLinux] added `RockyLinux 9.0 Docker` support
* [RockyLinux] added `RockyLinux 9.0 Vagrant` support

## Version 1.9.10 2022-07-25

* [Extra] fixes for lacking `ansible` package in `ansible.sh` provisioning script
Expand Down
78 changes: 43 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Set of Hashicorp's `Packer` 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)
![AlmaLinux](https://img.shields.io/badge/Linux-Alma-brightgreen)
![CentosLinux](https://img.shields.io/badge/Linux-CentOS-brightgreen)
![UbuntuLinux](https://img.shields.io/badge/Linux-Ubuntu-orange)

![Windows2016](https://img.shields.io/badge/Windows-2016-blue)
![Windows2019](https://img.shields.io/badge/Windows-2019-blue)
![Windows2022](https://img.shields.io/badge/Windows-2022-blue)

<!-- 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)
Expand Down Expand Up @@ -32,10 +43,6 @@
- [Templates Windows 2016](#templates-windows-2016)
- [Hyper-V Generation 2 Windows Server 2016 Standard Image](#hyper-v-generation-2-windows-server-2016-standard-image)
- [Standard Generation 2 Prerequisites](#standard-generation-2-prerequisites)
- [Templates Windows Server](#templates-windows-server)
- [Hyper-V Generation 2 Windows Server 1909 Standard Image](#hyper-v-generation-2-windows-server-1909-standard-image)
- [Hyper-V Generation 2 Windows Server 2004 Standard Image](#hyper-v-generation-2-windows-server-2004-standard-image)
- [Hyper-V Generation 2 Windows Server 20H2 Standard Image](#hyper-v-generation-2-windows-server-20h2-standard-image)
- [Templates Ubuntu](#templates-ubuntu)
- [Warnings - Ubuntu 20.x](#warnings---ubuntu-20x)
- [Hyper-V Generation 2 Ubuntu 20.04 Image](#hyper-v-generation-2-ubuntu-2004-image)
Expand All @@ -45,6 +52,11 @@
- [Hyper-V Generation 2 RockyLinux 8.6 Image](#hyper-v-generation-2-rockylinux-86-image)
- [Hyper-V Generation 2 RockyLinux 8.6 Vagrant support](#hyper-v-generation-2-rockylinux-86-vagrant-support)
- [Hyper-V Generation 2 RockyLinux 8.6 image with extra docker volume](#hyper-v-generation-2-rockylinux-86-image-with-extra-docker-volume)
- [Templates Rocky Linux 9](#templates-rocky-linux-9)
- [Warnings - RockyLinux 9](#warnings---rockylinux-9)
- [Hyper-V Generation 2 RockyLinux 9.0 Image](#hyper-v-generation-2-rockylinux-90-image)
- [Hyper-V Generation 2 RockyLinux 9.0 Vagrant support](#hyper-v-generation-2-rockylinux-90-vagrant-support)
- [Hyper-V Generation 2 RockyLinux 9.0 image with extra docker volume](#hyper-v-generation-2-rockylinux-90-image-with-extra-docker-volume)
- [Templates OracleLinux 8.x](#templates-oraclelinux-8x)
- [Warnings - OracleLinux 8](#warnings---oraclelinux-8)
- [Hyper-V Generation 2 OracleLinux 8.6 Image](#hyper-v-generation-2-oraclelinux-86-image)
Expand Down Expand Up @@ -88,13 +100,13 @@
### Install packer from Chocolatey

```cmd
choco install packer --version=1.8.2 -y
choco install packer --version=1.8.4 -y
```

### Install vagrant from Chocolatey

```cmd
choco install vagrant --version=2.2.19 -y
choco install vagrant --version=2.3.2 -y
```

### Use account with Administrator privileges for Hyper-V
Expand Down Expand Up @@ -363,35 +375,6 @@ This template uses this image name in Autounattendes.xml. If youre using differe
</InstallFrom>
```

## Templates Windows Server

### Hyper-V Generation 2 Windows Server 1909 Standard Image

If you need changes For - prepare `secondary1909.iso` with folder structure:

- ./extra/files/gen2-1909/Autounattend.xml => /Autounattend.xml
- ./extra/scripts/hyper-v/bootstrap.ps1 => /bootstrap.ps1

Run `hv_winserver_1909.ps1`

### Hyper-V Generation 2 Windows Server 2004 Standard Image

If you need changes For - prepare `secondary2004.iso` with folder structure:

- ./extra/files/gen2-2004/Autounattend.xml => /Autounattend.xml
- ./extra/scripts/hyper-v/bootstrap.ps1 => /bootstrap.ps1

Run `hv_winserver_2004.ps1`

### Hyper-V Generation 2 Windows Server 20H2 Standard Image

If you need changes For - prepare `secondary20H2.iso` with folder structure:

- ./extra/files/gen2-20H2/Autounattend.xml => /Autounattend.xml
- ./extra/scripts/hyper-v/bootstrap.ps1 => /bootstrap.ps1

Run `hv_winserver_20H2.ps1`

## Templates Ubuntu

### Warnings - Ubuntu 20.x
Expand Down Expand Up @@ -436,6 +419,31 @@ Run `hv_rockylinux86_vagrant.ps1` for RockyLinux 8.6

Run `hv_rockylinux86_docker.ps1` for RockyLinux 8.6

## Templates Rocky Linux 9

### Warnings - RockyLinux 9

- if required change `switch_name` parameter to switch's name you're using. In most situations packer manages it fine but there were a cases when it created new 'internal' switches without access to Internet. By design this setup will fail to download and apply updates.
- if needed - change `iso_url` variable to a proper iso name
- packer generates v8 machine configuration files (Windows 2016/Hyper-V 2016 as host) and v9 for Windows Server 2019/Windows 10 1809
- credentials for Windows machines: Administrator/password (removed after sysprep)
- credentials for Linux machines: root/password
- for Windows based machines adjust your settings in ./scripts/phase-2.ps1
- for Linux based machines adjust your settings in ./files/gen2-centos/provision.sh and ./files/gen2-centos/puppet.conf

### Hyper-V Generation 2 RockyLinux 9.0 Image

Run `hv_rockylinux9.ps1`

### Hyper-V Generation 2 RockyLinux 9.0 Vagrant support

Run `hv_rockylinux9_vagrant.ps1` for RockyLinux 9.0

### Hyper-V Generation 2 RockyLinux 9.0 image with extra docker volume

Run `hv_rockylinux9_docker.ps1` for RockyLinux 9.0


## Templates OracleLinux 8.x

### Warnings - OracleLinux 8
Expand Down
13 changes: 7 additions & 6 deletions extra/.ansible-lint
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
skip_list:
- package-latest
- command-instead-of-shell
- no-handler
- risky-file-permissions
- risky-shell-pipe
- no-relative-paths
- experimental
# - command-instead-of-shell
# - no-handler
# - risky-file-permissions
# - risky-shell-pipe
# - no-relative-paths
- experimental
- name[casing]
Loading

0 comments on commit c1ea2fe

Please sign in to comment.