From c5ca63cce415d636fb5f83d4b57638bd8b212f1d Mon Sep 17 00:00:00 2001 From: Marcin Bojko Date: Wed, 26 Jul 2023 19:58:08 +0200 Subject: [PATCH] Version 2.0.2 --- .gitignore | 3 +- .gitlab-ci.yml | 340 ++++++++++++++++-- CHANGELOG.md | 48 ++- README.md | 81 ++++- config.pkr.hcl | 4 + extra/.ansible-lint | 2 +- extra/files/cloud-init/alicloud/cloud.cfg | 104 ++++++ extra/files/cloud-init/generic/cloud.cfg | 105 ++++++ extra/files/cloud-init/oci/cloud.cfg | 102 ++++++ extra/files/gen2-almalinux9/ks.cfg | 38 +- extra/files/gen2-linux/ansible.sh | 10 +- extra/files/gen2-oraclelinux7/ks-kvm.cfg | 94 +++++ extra/files/gen2-oraclelinux8/ks-kvm.cfg | 110 ++++++ extra/files/gen2-oraclelinux9/ks-kvm.cfg | 106 ++++++ extra/files/gen2-oraclelinux9/ks.cfg | 33 +- extra/files/gen2-oraclelinux9/uefi.sh | 10 +- extra/files/gen2-rhel7/ks-kvm.cfg | 98 +++++ extra/files/gen2-rockylinux8/ks-kvm.cfg | 106 ++++++ extra/files/gen2-rockylinux9/ks.cfg | 34 +- extra/playbooks/provision_alma8_variables.yml | 2 +- extra/playbooks/provision_alma9_variables.yml | 2 +- extra/playbooks/provision_centos.yaml | 94 +++-- .../playbooks/provision_centos7_variables.yml | 2 +- .../playbooks/provision_centos8_variables.yml | 2 +- .../playbooks/provision_oracle8_variables.yml | 2 +- .../playbooks/provision_oracle9_variables.yml | 2 +- .../playbooks/provision_rocky8_variables.yml | 2 +- .../playbooks/provision_rocky9_variables.yml | 2 +- extra/scripts/phase-1.ps1 | 16 +- extra/scripts/phase-3.ps1 | 2 +- extra/scripts/phase-4.windows-updates.ps1 | 12 +- hv_almalinux92.ps1 | 39 ++ hv_almalinux92_docker.ps1 | 40 +++ hv_almalinux92_vagrant.ps1 | 44 +++ hv_oraclelinux92.ps1 | 39 ++ hv_oraclelinux92_docker.ps1 | 40 +++ hv_oraclelinux92_vagrant.ps1 | 44 +++ hv_rockylinux91.ps1 => hv_rockylinux92.ps1 | 4 +- ...1_docker.ps1 => hv_rockylinux92_docker.ps1 | 2 +- ...vagrant.ps1 => hv_rockylinux92_vagrant.ps1 | 4 +- templates/hv_almalinux9_g2.pkr.hcl | 186 ++++++++++ templates/hv_almalinux9_g2_docker.pkr.hcl | 184 ++++++++++ templates/hv_almalinux9_g2_vagrant.pkr.hcl | 193 ++++++++++ templates/hv_oraclelinux9_g2.pkr.hcl | 186 ++++++++++ templates/hv_oraclelinux9_g2_docker.pkr.hcl | 187 ++++++++++ templates/hv_oraclelinux9_g2_vagrant.pkr.hcl | 195 ++++++++++ ...g2.template => hv_almalinux92_g2.template} | 4 +- vagrant/hv_oraclelinux92_g2.template | 27 ++ vagrant/hv_rockylinux92_g2.template | 27 ++ variables/almalinux9.yml | 17 + variables/almalinux9_docker.yml | 16 + variables/oraclelinux9.yml | 17 + variables/oraclelinux9_docker.yml | 17 + variables/variables_almalinux92.pkvars.hcl | 17 + variables/variables_oraclelinux92.pkvars.hcl | 17 + ....hcl => variables_rockylinux92.pkvars.hcl} | 14 +- 56 files changed, 2960 insertions(+), 168 deletions(-) create mode 100644 extra/files/cloud-init/alicloud/cloud.cfg create mode 100644 extra/files/cloud-init/generic/cloud.cfg create mode 100644 extra/files/cloud-init/oci/cloud.cfg create mode 100644 extra/files/gen2-oraclelinux7/ks-kvm.cfg create mode 100644 extra/files/gen2-oraclelinux8/ks-kvm.cfg create mode 100644 extra/files/gen2-oraclelinux9/ks-kvm.cfg create mode 100644 extra/files/gen2-rhel7/ks-kvm.cfg create mode 100644 extra/files/gen2-rockylinux8/ks-kvm.cfg create mode 100644 hv_almalinux92.ps1 create mode 100644 hv_almalinux92_docker.ps1 create mode 100644 hv_almalinux92_vagrant.ps1 create mode 100644 hv_oraclelinux92.ps1 create mode 100644 hv_oraclelinux92_docker.ps1 create mode 100644 hv_oraclelinux92_vagrant.ps1 rename hv_rockylinux91.ps1 => hv_rockylinux92.ps1 (91%) rename hv_rockylinux91_docker.ps1 => hv_rockylinux92_docker.ps1 (94%) rename hv_rockylinux91_vagrant.ps1 => hv_rockylinux92_vagrant.ps1 (91%) create mode 100644 templates/hv_almalinux9_g2.pkr.hcl create mode 100644 templates/hv_almalinux9_g2_docker.pkr.hcl create mode 100644 templates/hv_almalinux9_g2_vagrant.pkr.hcl create mode 100644 templates/hv_oraclelinux9_g2.pkr.hcl create mode 100644 templates/hv_oraclelinux9_g2_docker.pkr.hcl create mode 100644 templates/hv_oraclelinux9_g2_vagrant.pkr.hcl rename vagrant/{hv_rockylinux91_g2.template => hv_almalinux92_g2.template} (89%) create mode 100644 vagrant/hv_oraclelinux92_g2.template create mode 100644 vagrant/hv_rockylinux92_g2.template create mode 100644 variables/almalinux9.yml create mode 100644 variables/almalinux9_docker.yml create mode 100644 variables/oraclelinux9.yml create mode 100644 variables/oraclelinux9_docker.yml create mode 100644 variables/variables_almalinux92.pkvars.hcl create mode 100644 variables/variables_oraclelinux92.pkvars.hcl rename variables/{variables_rockylinux91.pkvars.hcl => variables_rockylinux92.pkvars.hcl} (58%) diff --git a/.gitignore b/.gitignore index 7ac9dcc..ffb3a23 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ extra/.snippets* vbox/* *.box .scripts/* -.vscode/* \ No newline at end of file +.vscode/* +.snippets/* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 845d589..a3d2fc8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,11 +1,13 @@ variables: - packer_version: "1.8.4" + packer_version: "1.9.2" dind: 20.10-dind - build_alma: "false" + build_alma8: "false" + build_alma9: "false" build_centos: "false" build_rocky8: "false" build_rocky9: "false" - build_oracle: "false" + build_oracle8: "false" + build_oracle9: "false" build_ubuntu2004: "false" build_ubuntu2204: "false" build_windows2022_std: "false" @@ -14,19 +16,23 @@ stages: - get-packer - centos7-validate - alma8-validate + - alma9-validate - rocky8-validate - rocky9-validate - oracle8-validate + - oracle9-validate - ubuntu20-validate - windows2019-validate - windows2022-validate - ansible-lint - install_packer - - build_alma + - build_alma8 + - build_alma9 - build_rocky8 - build_rocky9 - build_centos - - build_oracle + - build_oracle8 + - build_oracle9 - build_ubuntu - build_windows2022 get-packer: @@ -52,6 +58,7 @@ centos79: before_script: - export template_file="./templates/hv_centos7_g2.pkr.hcl" - export var_file="./variables/variables_centos79.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -68,6 +75,7 @@ centos79-docker: before_script: - export template_file="./templates/hv_centos7_g2_docker.pkr.hcl" - export var_file="./variables/variables_centos79.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -84,6 +92,7 @@ centos79-vagrant: before_script: - export template_file="./templates/hv_centos7_g2_vagrant.pkr.hcl" - export var_file="./variables/variables_centos79.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -100,6 +109,7 @@ alma8: before_script: - export template_file="./templates/hv_almalinux8_g2.pkr.hcl" - export var_file="./variables/variables_almalinux86.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -116,6 +126,7 @@ alma8-vagrant: before_script: - export template_file="./templates/hv_almalinux8_g2_vagrant.pkr.hcl" - export var_file="./variables/variables_almalinux86.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -132,6 +143,58 @@ alma8-docker: before_script: - export template_file="./templates/hv_almalinux8_g2_docker.pkr.hcl" - export var_file="./variables/variables_almalinux86.pkvars.hcl" + - ./packer init config.pkr.hcl + script: + - ./packer version --version + - ./packer validate -var-file="$var_file" "$template_file" + tags: + - docker + - packer + needs: + - get-packer +alma9: + stage: alma9-validate + image: alpine + services: + - docker:$dind + before_script: + - export template_file="./templates/hv_almalinux9_g2.pkr.hcl" + - export var_file="./variables/variables_almalinux92.pkvars.hcl" + - ./packer init config.pkr.hcl + script: + - ./packer version --version + - ./packer validate -var-file="$var_file" "$template_file" + tags: + - docker + - packer + needs: + - get-packer +alma9-docker: + stage: alma9-validate + image: alpine + services: + - docker:$dind + before_script: + - export template_file="./templates/hv_almalinux9_g2_docker.pkr.hcl" + - export var_file="./variables/variables_almalinux92.pkvars.hcl" + - ./packer init config.pkr.hcl + script: + - ./packer version --version + - ./packer validate -var-file="$var_file" "$template_file" + tags: + - docker + - packer + needs: + - get-packer +alma9-vagrant: + stage: alma9-validate + image: alpine + services: + - docker:$dind + before_script: + - export template_file="./templates/hv_almalinux9_g2_vagrant.pkr.hcl" + - export var_file="./variables/variables_almalinux92.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -149,6 +212,7 @@ rocky8: before_script: - export template_file="./templates/hv_rockylinux8_g2.pkr.hcl" - export var_file="./variables/variables_rockylinux87.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -165,6 +229,7 @@ rocky8-vagrant: before_script: - export template_file="./templates/hv_rockylinux8_g2_vagrant.pkr.hcl" - export var_file="./variables/variables_rockylinux87.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -181,6 +246,7 @@ rocky8-docker: before_script: - export template_file="./templates/hv_rockylinux8_g2_docker.pkr.hcl" - export var_file="./variables/variables_rockylinux87.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -197,7 +263,8 @@ rocky9: - docker:$dind before_script: - export template_file="./templates/hv_rockylinux9_g2.pkr.hcl" - - export var_file="./variables/variables_rockylinux91.pkvars.hcl" + - export var_file="./variables/variables_rockylinux92.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -213,7 +280,25 @@ rocky9-docker: - docker:$dind before_script: - export template_file="./templates/hv_rockylinux9_g2_docker.pkr.hcl" - - export var_file="./variables/variables_rockylinux91.pkvars.hcl" + - export var_file="./variables/variables_rockylinux92.pkvars.hcl" + - ./packer init config.pkr.hcl + script: + - ./packer version --version + - ./packer validate -var-file="$var_file" "$template_file" + tags: + - docker + - packer + needs: + - get-packer +rocky9-vagrant: + stage: rocky9-validate + image: alpine + services: + - docker:$dind + before_script: + - export template_file="./templates/hv_rockylinux9_g2_vagrant.pkr.hcl" + - export var_file="./variables/variables_rockylinux92.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -231,6 +316,7 @@ oracle8: before_script: - export template_file="./templates/hv_oraclelinux8_g2.pkr.hcl" - export var_file="./variables/variables_oraclelinux86.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -247,6 +333,7 @@ oracle8-vagrant: before_script: - export template_file="./templates/hv_oraclelinux8_g2_vagrant.pkr.hcl" - export var_file="./variables/variables_oraclelinux86.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -263,6 +350,59 @@ oracle8-docker: before_script: - export template_file="./templates/hv_oraclelinux8_g2_docker.pkr.hcl" - export var_file="./variables/variables_oraclelinux86.pkvars.hcl" + - ./packer init config.pkr.hcl + script: + - ./packer version --version + - ./packer validate -var-file="$var_file" "$template_file" + tags: + - docker + - packer + needs: + - get-packer +# Oracle 9 Validate +oracle9: + stage: oracle9-validate + image: alpine + services: + - docker:$dind + before_script: + - export template_file="./templates/hv_oraclelinux9_g2.pkr.hcl" + - export var_file="./variables/variables_oraclelinux92.pkvars.hcl" + - ./packer init config.pkr.hcl + script: + - ./packer version --version + - ./packer validate -var-file="$var_file" "$template_file" + tags: + - docker + - packer + needs: + - get-packer +oracle9-docker: + stage: oracle9-validate + image: alpine + services: + - docker:$dind + before_script: + - export template_file="./templates/hv_oraclelinux9_g2_docker.pkr.hcl" + - export var_file="./variables/variables_oraclelinux92.pkvars.hcl" + - ./packer init config.pkr.hcl + script: + - ./packer version --version + - ./packer validate -var-file="$var_file" "$template_file" + tags: + - docker + - packer + needs: + - get-packer +oracle9-vagrant: + stage: oracle9-validate + image: alpine + services: + - docker:$dind + before_script: + - export template_file="./templates/hv_oraclelinux9_g2_vagrant.pkr.hcl" + - export var_file="./variables/variables_oraclelinux92.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -271,6 +411,7 @@ oracle8-docker: - packer needs: - get-packer +# Ubuntu ubuntu2004: stage: ubuntu20-validate image: alpine @@ -279,6 +420,7 @@ ubuntu2004: before_script: - export template_file="./templates/hv_ubuntu2004_g2.pkr.hcl" - export var_file="./variables/variables_ubuntu2004.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -295,6 +437,7 @@ ubuntu2204: before_script: - export template_file="./templates/hv_ubuntu2204_g2.pkr.hcl" - export var_file="./variables/variables_ubuntu2204.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -311,6 +454,7 @@ lts2019-std: before_script: - export template_file="./templates/hv_win2019_g2.pkr.hcl" - export var_file="./variables/variables_win2019_std.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -327,6 +471,7 @@ lts2019-std-vagrant: before_script: - export template_file="./templates/hv_win2019_g2_vagrant.pkr.hcl" - export var_file="./variables/variables_win2019_std.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -343,6 +488,7 @@ lts2019-dc: before_script: - export template_file="./templates/hv_win2019_g2.pkr.hcl" - export var_file="./variables/variables_win2019_dc.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -359,6 +505,7 @@ lts2019-dc-vagrant: before_script: - export template_file="./templates/hv_win2019_g2_vagrant.pkr.hcl" - export var_file="./variables/variables_win2019_dc.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -376,6 +523,7 @@ lts2022-std: before_script: - export template_file="./templates/hv_win2022_g2.pkr.hcl" - export var_file="./variables/variables_win2022_std.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -392,6 +540,7 @@ lts2022-dc: before_script: - export template_file="./templates/hv_win2022_g2.pkr.hcl" - export var_file="./variables/variables_win2022_dc.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -408,6 +557,7 @@ lts2022-std-vagrant: before_script: - export template_file="./templates/hv_win2022_g2_vagrant.pkr.hcl" - export var_file="./variables/variables_win2022_std.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -424,6 +574,7 @@ lts2022-dc-vagrant: before_script: - export template_file="./templates/hv_win2022_g2_vagrant.pkr.hcl" - export var_file="./variables/variables_win2022_dc.pkvars.hcl" + - ./packer init config.pkr.hcl script: - ./packer version --version - ./packer validate -var-file="$var_file" "$template_file" @@ -468,55 +619,110 @@ install_packer: tags: - windows - hyperv -build_alma: - stage: build_alma +build_alma8: + stage: build_alma8 script: - pwd - '$env:PACKER_CACHE_DIR="e:\packer_cache"' - "Get-Vm -name packer-*|Stop-VM -Force -TurnOff -Verbose" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_almalinux86.ps1 rules: - - if: $build_alma == "true" + - if: $build_alma8 == "true" when: on_success tags: - windows - hyperv -build_alma_docker: - stage: build_alma +build_alma8_docker: + stage: build_alma8 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" + - packer init config.pkr.hcl - .\hv_almalinux86_docker.ps1 rules: - - if: $build_alma == "true" + - if: $build_alma8 == "true" when: on_success tags: - windows - hyperv needs: - - build_alma -build_alma_vagrant: - stage: build_alma + - build_alma8 +build_alma8_vagrant: + stage: build_alma8 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" + - packer init config.pkr.hcl - .\hv_almalinux86_vagrant.ps1 rules: - - if: $build_alma == "true" + - if: $build_alma8 == "true" + when: on_success + tags: + - windows + - hyperv + needs: + - build_alma8_docker +build_alma9: + stage: build_alma9 + script: + - pwd + - '$env:PACKER_CACHE_DIR="e:\packer_cache"' + - "Get-Vm -name packer-*|Stop-VM -Force -TurnOff -Verbose" + - Sleep 120 + - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl + - .\hv_almalinux92.ps1 + rules: + - if: $build_alma9 == "true" + when: on_success + tags: + - windows + - hyperv +build_alma9_docker: + stage: build_alma9 + 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" + - packer init config.pkr.hcl + - .\hv_almalinux92_docker.ps1 + rules: + - if: $build_alma9 == "true" + when: on_success + tags: + - windows + - hyperv + needs: + - build_alma9 +build_alma9_vagrant: + stage: build_alma9 + 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" + - packer init config.pkr.hcl + - .\hv_almalinux92_vagrant.ps1 + rules: + - if: $build_alma9 == "true" when: on_success tags: - windows - hyperv needs: - - build_alma_docker + - build_alma9_docker # Rocky build_rocky8: stage: build_rocky8 @@ -526,6 +732,7 @@ build_rocky8: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_rockylinux87.ps1 rules: - if: $build_rocky8 == "true" @@ -541,6 +748,7 @@ build_rocky8_docker: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_rockylinux87_docker.ps1 rules: - if: $build_rocky8 == "true" @@ -558,6 +766,7 @@ build_rocky8_vagrant: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_rockylinux87_vagrant.ps1 rules: - if: $build_rocky8 == "true" @@ -576,7 +785,8 @@ build_rocky9: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" - - .\hv_rockylinux91.ps1 + - packer init config.pkr.hcl + - .\hv_rockylinux92.ps1 rules: - if: $build_rocky9 == "true" when: on_success @@ -591,7 +801,8 @@ build_rocky9_docker: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" - - .\hv_rockylinux91_docker.ps1 + - packer init config.pkr.hcl + - .\hv_rockylinux92_docker.ps1 rules: - if: $build_rocky9 == "true" when: on_success @@ -608,7 +819,8 @@ build_rocky9_vagrant: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" - - .\hv_rockylinux91_vagrant.ps1 + - packer init config.pkr.hcl + - .\hv_rockylinux92_vagrant.ps1 rules: - if: $build_rocky9 == "true" when: on_success @@ -618,55 +830,112 @@ build_rocky9_vagrant: needs: - build_rocky9_docker # Build Oracle -build_oracle: - stage: build_oracle +build_oracle8: + stage: build_oracle8 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" + - packer init config.pkr.hcl - .\hv_oraclelinux86.ps1 rules: - - if: $build_oracle == "true" + - if: $build_oracle8 == "true" when: on_success tags: - windows - hyperv -build_oracle_docker: - stage: build_oracle +build_oracle8_docker: + stage: build_oracle8 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" + - packer init config.pkr.hcl - .\hv_oraclelinux86_docker.ps1 rules: - - if: $build_oracle == "true" + - if: $build_oracle8 == "true" when: on_success tags: - windows - hyperv needs: - - build_oracle -build_oracle_vagrant: - stage: build_oracle + - build_oracle8 +build_oracle8_vagrant: + stage: build_oracle8 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" + - packer init config.pkr.hcl - .\hv_oraclelinux86_vagrant.ps1 rules: - - if: $build_oracle == "true" + - if: $build_oracle8 == "true" + when: on_success + tags: + - windows + - hyperv + needs: + - build_oracle8 +# Oracle 9 +build_oracle9: + stage: build_oracle9 + 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" + - packer init config.pkr.hcl + - .\hv_oraclelinux92.ps1 + rules: + - if: $build_oracle9 == "true" + when: on_success + tags: + - windows + - hyperv +build_oracle9_docker: + stage: build_oracle9 + 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" + - packer init config.pkr.hcl + - .\hv_oraclelinux92_docker.ps1 + rules: + - if: $build_oracle9 == "true" + when: on_success + tags: + - windows + - hyperv + needs: + - build_oracle9 +build_oracle9_vagrant: + stage: build_oracle9 + 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" + - packer init config.pkr.hcl + - .\hv_oraclelinux92_vagrant.ps1 + rules: + - if: $build_oracle9 == "true" when: on_success tags: - windows - hyperv needs: - - build_oracle + - build_oracle9 + # CentOS build_centos: stage: build_centos @@ -676,6 +945,7 @@ build_centos: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_centos79.ps1 rules: - if: $build_centos == "true" @@ -691,6 +961,7 @@ build_centos_docker: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_centos79_docker.ps1 rules: - if: $build_centos == "true" @@ -708,6 +979,7 @@ build_centos_vagrant: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_centos79_vagrant.ps1 rules: - if: $build_centos == "true" @@ -726,6 +998,7 @@ build_ubuntu2004: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_ubuntu2004.ps1 rules: - if: $build_ubuntu2004 == "true" @@ -741,6 +1014,7 @@ build_ubuntu2204: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_ubuntu2204.ps1 rules: - if: $build_ubuntu2204 == "true" @@ -757,6 +1031,7 @@ build_windows_2022_std: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_win2022_std.ps1 rules: - if: $build_windows2022_std == "true" @@ -772,6 +1047,7 @@ build_windows_2022_dc: - "Get-Vm -name packer-*|Stop-VM -Force" - Sleep 120 - "Get-Vm -name packer-*|Remove-VM -Force" + - packer init config.pkr.hcl - .\hv_win2022_dc.ps1 rules: - if: $build_windows2022_dc == "true" diff --git a/CHANGELOG.md b/CHANGELOG.md index 1390f9d..588bac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,51 @@ # Changelog +## Version 2.0.2 2023-07-26 + +Codename: BAD - [https://www.youtube.com/watch?v=dsUXAEzaC3Q](https://www.youtube.com/watch?v=dsUXAEzaC3Q) + +* [BREAKING_CHANGE] for packer >= 1.9.0 hyperv-iso module was moved from core to plugins. Proper change was already set in `config.pkr.hcl`, but you have to remember to run `packer init --upgrade config.pkr.hcl` before running `packer build` command + + ```hcl + packer { + required_plugins { + windows-update = { + version = "0.14.1" + source = "github.com/rgl/windows-update" + } + hyperv = { + version = ">= 1.1.0" + source = "github.com/hashicorp/hyperv" + } + } + } + ``` + +* [Extra] `extra` scripts and playbooks optimizations +* [Extra] `ks.cgf` files for all RHEL 9 clones - switching timezone to UTC during build +* [Extra] ansible-lint fixes over playbooks +* [Extra] resized partitions (/boot and /boot/EFI) to fit bigger kernel and initrd files as well as more kernels in Oracle Linux UEK. This will allow for UEK an standard kernels to coexist. + + ```ini + 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 + ``` + +* [RockyLinux] added `RockyLinux 9.2` support +* [RockyLinux] added `RockyLinux 9.2` Docker support +* [RockyLinux] added `RockyLinux 9.2` Vagrant support +* [OracleLinux] added `OracleLinux 9.2` support +* [OracleLinux] added `OracleLinux 9.2` Docker support +* [OracleLinux] added `OracleLinux 9.2` Vagrant support +* [AlmaLinux] added `AlmaLinux 9.2` support +* [AlmaLinux] added `AlmaLinux 9.2` Docker support +* [AlmaLinux] added `AlmaLinux 9.2` Vagrant support + ## Version 2.0.1 2022-12-20 Codename: Jedwab - [https://www.youtube.com/watch?v=G_Lsdk88AYM](https://www.youtube.com/watch?v=G_Lsdk88AYM) @@ -10,7 +56,7 @@ Codename: Jedwab - [https://www.youtube.com/watch?v=G_Lsdk88AYM](https://www.you * [RockyLinux] added `RockyLinux 9.1 Vagrant` support * [RockyLinux] added `RockyLinux 8.7` support * [RockyLinux] added `RockyLinux 8.7 Docker` support -* [RockyLinux] added `RockyLinux 8.7 Vagrant` support +* [RockyLinux] added `RockyLinux 8.7 Vagrant` supportv * introduced required packer plugins * reworked README.md diff --git a/README.md b/README.md index 0726d62..d96ea68 100644 --- a/README.md +++ b/README.md @@ -55,19 +55,29 @@ - [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.1 Image](#hyper-v-generation-2-rockylinux-91-image) - - [Hyper-V Generation 2 RockyLinux 9.1 Vagrant support](#hyper-v-generation-2-rockylinux-91-vagrant-support) + - [Hyper-V Generation 2 RockyLinux 9.2 Image](#hyper-v-generation-2-rockylinux-92-image) + - [Hyper-V Generation 2 RockyLinux 9.2 Vagrant support](#hyper-v-generation-2-rockylinux-92-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) - [Hyper-V Generation 2 OracleLinux 8.6 Vagrant support](#hyper-v-generation-2-oraclelinux-86-vagrant-support) - [Hyper-V Generation 2 OracleLinux 8.6 image with extra docker volume](#hyper-v-generation-2-oraclelinux-86-image-with-extra-docker-volume) + - [Templates OracleLinux 9.x](#templates-oraclelinux-9x) + - [Warnings - OracleLinux 9](#warnings---oraclelinux-9) + - [Hyper-V Generation 2 OracleLinux 9.2 Image](#hyper-v-generation-2-oraclelinux-92-image) + - [Hyper-V Generation 2 OracleLinux 9.2 Vagrant support](#hyper-v-generation-2-oraclelinux-92-vagrant-support) + - [Hyper-V Generation 2 OracleLinux 9.2 image with extra docker volume](#hyper-v-generation-2-oraclelinux-92-image-with-extra-docker-volume) - [Templates AlmaLinux 8.x](#templates-almalinux-8x) - [Warnings - AlmaLinux 8](#warnings---almalinux-8) - [Hyper-V Generation 2 AlmaLinux 8.6 Image](#hyper-v-generation-2-almalinux-86-image) - [Hyper-V Generation 2 AlmaLinux 8.6 Vagrant support](#hyper-v-generation-2-almalinux-86-vagrant-support) - [Hyper-V Generation 2 AlmaLinux 8.6 image with extra docker volume](#hyper-v-generation-2-almalinux-86-image-with-extra-docker-volume) + - [Templates AlmaLinux 9.x](#templates-almalinux-9x) + - [Warnings - AlmaLinux 9](#warnings---almalinux-9) + - [Hyper-V Generation 2 AlmaLinux 9.2 Image](#hyper-v-generation-2-almalinux-92-image) + - [Hyper-V Generation 2 AlmaLinux 9.2 Vagrant support](#hyper-v-generation-2-almalinux-92-vagrant-support) + - [Hyper-V Generation 2 AlmaLinux 9.2 image with extra docker volume](#hyper-v-generation-2-almalinux-92-image-with-extra-docker-volume) - [Templates CentOS 7.x](#templates-centos-7x) - [Warnings - CentOS Docker](#warnings---centos-docker) - [Hyper-V Generation 2 CentOS 7.9](#hyper-v-generation-2-centos-79) @@ -87,12 +97,13 @@ - [About](#about) + ## Requirements -- packer <=`1.8.4`. Do not use packer below 1.7.0 version. For previous packer versions use previous releases from this repository +- packer <=`1.9.1`. 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.2.19` - for `vagrant` version of scripts. Boxes (prebuilt) are already available here: [https://app.vagrantup.com/marcinbojko](https://app.vagrantup.com/marcinbojko) +- [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) - be aware, for 2016 - VMs are in version 8.0, for 2019 - VMs are in version 9.0. There is no way to reuse higher version in previous operating system. If you need v8.0 - build and use only VHDX. - properly constructed virtual switch in Hyper-v allowing virtual machine to get IP from DHCP and contact Hyper-V server on mentioned packer ports. This is a must, if kickstart is reachable over the network. @@ -101,7 +112,7 @@ ### Install packer from Chocolatey ```cmd -choco install packer --version=1.8.4 -y +choco install packer --version=1.9.1 -y ``` ### Install required plugins @@ -115,7 +126,7 @@ packer init --upgrade config.pkr.hcl ### Install vagrant from Chocolatey ```cmd -choco install vagrant --version=2.3.2 -y +choco install vagrant --version=2.3.4 -y ``` ### Use account with Administrator privileges for Hyper-V @@ -442,17 +453,17 @@ Run `hv_rockylinux87_docker.ps1` for RockyLinux 8.7 - 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.1 Image +### Hyper-V Generation 2 RockyLinux 9.2 Image -Run `hv_rockylinux91.ps1` +Run `hv_rockylinux92.ps1` -### Hyper-V Generation 2 RockyLinux 9.1 Vagrant support +### Hyper-V Generation 2 RockyLinux 9.2 Vagrant support -Run `hv_rockylinux91_vagrant.ps1` for RockyLinux 9.1 +Run `hv_rockylinux92_vagrant.ps1` for RockyLinux 9.2 ### Hyper-V Generation 2 RockyLinux 9.0 image with extra docker volume -Run `hv_rockylinux91_docker.ps1` for RockyLinux 9.1 +Run `hv_rockylinux92_docker.ps1` for RockyLinux 9.2 ## Templates OracleLinux 8.x @@ -478,6 +489,30 @@ Run `hv_oraclelinux86_vagrant.ps1` for OracleLinux 8.5 Run `hv_oraclelinux86_docker.ps1` for OracleLinux 8.6 +## Templates OracleLinux 9.x + +### Warnings - OracleLinux 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 OracleLinux 9.2 Image + +Run `hv_oraclelinux92.ps1` + +### Hyper-V Generation 2 OracleLinux 9.2 Vagrant support + +Run `hv_oraclelinux92_vagrant.ps1` for OracleLinux 9.2 + +### Hyper-V Generation 2 OracleLinux 9.2 image with extra docker volume + +Run `hv_oraclelinux92_docker.ps1` for OracleLinux 9.2 + ## Templates AlmaLinux 8.x ### Warnings - AlmaLinux 8 @@ -502,6 +537,30 @@ Run `hv_almalinux86_vagrant.ps1` for AlmaLinux 8.6 Run `hv_almalinux86_docker.ps1` for AlmaLinux 8.6 +## Templates AlmaLinux 9.x + +### Warnings - AlmaLinux 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 AlmaLinux 9.2 Image + +Run `hv_almalinux92.ps1` + +### Hyper-V Generation 2 AlmaLinux 9.2 Vagrant support + +Run `hv_almalinux92_vagrant.ps1` for AlmaLinux 9.2 + +### Hyper-V Generation 2 AlmaLinux 9.2 image with extra docker volume + +Run `hv_almalinux92_docker.ps1` for AlmaLinux 9.2 + ## Templates CentOS 7.x ### Warnings - CentOS Docker diff --git a/config.pkr.hcl b/config.pkr.hcl index c31ed45..1abac51 100644 --- a/config.pkr.hcl +++ b/config.pkr.hcl @@ -4,5 +4,9 @@ packer { version = "0.14.1" source = "github.com/rgl/windows-update" } + hyperv = { + version = ">= 1.1.0" + source = "github.com/hashicorp/hyperv" + } } } diff --git a/extra/.ansible-lint b/extra/.ansible-lint index 08bfc97..30e1623 100644 --- a/extra/.ansible-lint +++ b/extra/.ansible-lint @@ -6,4 +6,4 @@ skip_list: # - risky-shell-pipe # - no-relative-paths - experimental - - name[casing] + - name[casing] \ No newline at end of file diff --git a/extra/files/cloud-init/alicloud/cloud.cfg b/extra/files/cloud-init/alicloud/cloud.cfg new file mode 100644 index 0000000..ae78fab --- /dev/null +++ b/extra/files/cloud-init/alicloud/cloud.cfg @@ -0,0 +1,104 @@ +# The top level settings are used as module +# and system configuration. +# A set of users which may be applied and/or used by various modules +# when a 'default' entry is found it will reference the 'default_user' +# from the distro configuration specified below +users: + - default +#user: +# name: root +# lock_passwd: False +# If this is set, 'root' will not be able to ssh in and they +# will get a message to login instead as the default $user +disable_root: True +mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2'] +resize_rootfs_tmp: /dev +ssh_pwauth: 0 + +# This will cause the set+update hostname module to not operate (if true) +preserve_hostname: false + +# If you use datasource_list array, keep array items in a single line. +# If you use multi line array, ds-identify script won't read array items. +# Example datasource config +# datasource: +# Ec2: +# metadata_urls: [ 'blah.com' ] +# timeout: 5 # (defaults to 50 seconds) +# max_wait: 10 # (defaults to 120 seconds) + +# Default redhat settings: +ssh_deletekeys: true +ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519'] +disable_vmware_customization: false +syslog_fix_perms: root:root + +datasource_list: [ AliYun ] +# Example datasource config +datasource: + AliYun: + support_xen: false + timeout: 15 # (defaults to 50 seconds) max_wait: 60 # (defaults to 120 seconds) + metadata_urls: ["http://100.100.100.200"] + +# The modules that run in the 'init' stage +cloud_init_modules: + - migrator + - seed_random + - bootcmd + - write-files + - growpart + - resizefs + - disk_setup + - mounts + - set_hostname + - update_hostname + - update_etc_hosts + - ca-certs + - rsyslog + - users-groups + - ssh + +# The modules that run in the 'config' stage +cloud_config_modules: + - set-passwords + - yum-add-repo + - timezone + - disable-ec2-metadata + - runcmd + +# The modules that run in the 'final' stage +cloud_final_modules: + - package-update-upgrade-install + - puppet + - chef + - mcollective + - salt-minion + - rightscale_userdata + - scripts-vendor + - scripts-per-once + - scripts-per-boot + - scripts-per-instance + - scripts-user + - ssh-authkey-fingerprints + - keys-to-console + - phone-home + - final-message + - power-state-change + +# System and/or distro specific settings +# (not accessible to handlers/transforms) +system_info: + default_user: + name: ecs-user + lock_passwd: true + gecos: Cloud User + groups: [adm, systemd-journal] + sudo: ["ALL=(ALL) NOPASSWD:ALL"] + shell: /bin/bash + distro: rhel + # Other config here will be given to the distro class and/or path classes + paths: + cloud_dir: /var/lib/cloud/ + templates_dir: /etc/cloud/templates/ + ssh_svcname: sshd diff --git a/extra/files/cloud-init/generic/cloud.cfg b/extra/files/cloud-init/generic/cloud.cfg new file mode 100644 index 0000000..3dd34c8 --- /dev/null +++ b/extra/files/cloud-init/generic/cloud.cfg @@ -0,0 +1,105 @@ +# The top level settings are used as module +# and system configuration. +# A set of users which may be applied and/or used by various modules +# when a 'default' entry is found it will reference the 'default_user' +# from the distro configuration specified below +users: + - default +#user: +# name: root +# lock_passwd: False +# If this is set, 'root' will not be able to ssh in and they +# will get a message to login instead as the default $user +disable_root: True +mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2'] +resize_rootfs_tmp: /dev +ssh_pwauth: 0 + +# This will cause the set+update hostname module to not operate (if true) +preserve_hostname: false + +# If you use datasource_list array, keep array items in a single line. +# If you use multi line array, ds-identify script won't read array items. +# Example datasource config +# datasource: +# Ec2: +# metadata_urls: [ 'blah.com' ] +# timeout: 5 # (defaults to 50 seconds) +# max_wait: 10 # (defaults to 120 seconds) + +# Default redhat settings: +ssh_deletekeys: true +ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519'] +disable_vmware_customization: false +syslog_fix_perms: root:root + +# datasource_list: [ AliYun ] +# Example datasource config +# datasource: +# AliYun: +# support_xen: false +# timeout: 15 # (defaults to 50 seconds) max_wait: 60 # (defaults to 120 seconds) +# metadata_urls: ["http://100.100.100.200"] + + +# The modules that run in the 'init' stage +cloud_init_modules: + - migrator + - seed_random + - bootcmd + - write-files + - growpart + - resizefs + - disk_setup + - mounts + - set_hostname + - update_hostname + - update_etc_hosts + - ca-certs + - rsyslog + - users-groups + - ssh + +# The modules that run in the 'config' stage +cloud_config_modules: + - set-passwords + - yum-add-repo + - timezone + - disable-ec2-metadata + - runcmd + +# The modules that run in the 'final' stage +cloud_final_modules: + - package-update-upgrade-install + - puppet + - chef + - mcollective + - salt-minion + - rightscale_userdata + - scripts-vendor + - scripts-per-once + - scripts-per-boot + - scripts-per-instance + - scripts-user + - ssh-authkey-fingerprints + - keys-to-console + - phone-home + - final-message + - power-state-change + +# System and/or distro specific settings +# (not accessible to handlers/transforms) +system_info: + default_user: + name: ecs-user + lock_passwd: true + gecos: Cloud User + groups: [adm, systemd-journal] + sudo: ["ALL=(ALL) NOPASSWD:ALL"] + shell: /bin/bash + distro: rhel + # Other config here will be given to the distro class and/or path classes + paths: + cloud_dir: /var/lib/cloud/ + templates_dir: /etc/cloud/templates/ + ssh_svcname: sshd diff --git a/extra/files/cloud-init/oci/cloud.cfg b/extra/files/cloud-init/oci/cloud.cfg new file mode 100644 index 0000000..73408d0 --- /dev/null +++ b/extra/files/cloud-init/oci/cloud.cfg @@ -0,0 +1,102 @@ +# The top level settings are used as module +# and system configuration. +# A set of users which may be applied and/or used by various modules +# when a 'default' entry is found it will reference the 'default_user' +# from the distro configuration specified below +users: + - default +#user: +# name: root +# lock_passwd: False +# If this is set, 'root' will not be able to ssh in and they +# will get a message to login instead as the default $user +disable_root: True +mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2'] +resize_rootfs_tmp: /dev +ssh_pwauth: 0 + +# This will cause the set+update hostname module to not operate (if true) +preserve_hostname: false + +# If you use datasource_list array, keep array items in a single line. +# If you use multi line array, ds-identify script won't read array items. +# Example datasource config +# datasource: +# Ec2: +# metadata_urls: [ 'blah.com' ] +# timeout: 5 # (defaults to 50 seconds) +# max_wait: 10 # (defaults to 120 seconds) + +# Default redhat settings: +ssh_deletekeys: true +ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519'] +disable_vmware_customization: false +syslog_fix_perms: root:root + +datasource_list: [ Oracle] +# Example datasource config +datasource: + Oracle: + configure_secondary_nics: false + +# The modules that run in the 'init' stage +cloud_init_modules: + - migrator + - seed_random + - bootcmd + - write-files + - growpart + - resizefs + - disk_setup + - mounts + - set_hostname + - update_hostname + - update_etc_hosts + - ca-certs + - rsyslog + - users-groups + - ssh + +# The modules that run in the 'config' stage +cloud_config_modules: + - set-passwords + - yum-add-repo + - timezone + - disable-ec2-metadata + - runcmd + +# The modules that run in the 'final' stage +cloud_final_modules: + - package-update-upgrade-install + - puppet + - chef + - mcollective + - salt-minion + - rightscale_userdata + - scripts-vendor + - scripts-per-once + - scripts-per-boot + - scripts-per-instance + - scripts-user + - ssh-authkey-fingerprints + - keys-to-console + - phone-home + - final-message + - power-state-change + +# System and/or distro specific settings +# (not accessible to handlers/transforms) +system_info: + default_user: + name: cloud-user + lock_passwd: true + gecos: Cloud User + groups: [adm, systemd-journal] + sudo: ["ALL=(ALL) NOPASSWD:ALL"] + shell: /bin/bash + distro: rhel + # Other config here will be given to the distro class and/or path classes + paths: + cloud_dir: /var/lib/cloud/ + templates_dir: /etc/cloud/templates/ + ssh_svcname: sshd diff --git a/extra/files/gen2-almalinux9/ks.cfg b/extra/files/gen2-almalinux9/ks.cfg index cf04d42..7acf159 100644 --- a/extra/files/gen2-almalinux9/ks.cfg +++ b/extra/files/gen2-almalinux9/ks.cfg @@ -1,6 +1,5 @@ #version=RHEL9 # X Window System configuration information -xconfig --startxonboot # License agreement eula --agreed # Use graphical install @@ -8,7 +7,7 @@ text # SELinux configuration selinux --disabled # Network information -ignoredisk --only-use=sda +network --bootproto=dhcp --noipv6 --activate # Use CDROM installation media cdrom # Run the Setup Agent on first boot @@ -25,9 +24,9 @@ lang en_US --addsupport=en_GB.UTF-8 repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream # Root password -rootpw --iscrypted $6$v1A3VJeCQtb3E5pD$pegFkSe75oeG8L9JaOjI9DYlWPYMV2V94xELjOThdt4u36eBsQFnDXEkqBMVXT9OJRzd2xwXvMy7xqVVM6UlV1 +rootpw --plaintext password # System timezone -timezone Europe/Warsaw --utc +timezone UTC --utc # System bootloader configuration #bootloader --location=mbr --boot-drive=sda bootloader @@ -36,14 +35,13 @@ zerombr # Partition clearing information clearpart --all --initlabel # # Disk partitioning information -part /boot/efi --fstype="vfat" --size=200 -part /boot --fstype="ext4" --size=1024 -part swap --fstype="swap" --size=16384 +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 -@headless-management @legacy-unix @system-tools bash @@ -76,27 +74,23 @@ tuned-profiles-atomic %end # post part -%post +# 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 -sed -ri 's/^UsePAM yes/UsePAM no/' /etc/ssh/sshd_config -#PermitRootLogin prohibit-password +systemctl enable sshd +%end -systemctl enable sshd --now -systemctl restart sshd -systemctl enable tuned --now -tuned-adm profile virtual-guest +# post part +%post --log=/var/log/anaconda/kickstart_post.log +systemctl enable qemu-guest-agent systemctl set-default multi-user.target -systemctl disable initial-setup-text -systemctl disable initial-setup-graphical -initial_setup/tui/spokes/eula.py +%end -# +# post part +%post --log=/var/log/anaconda/kickstart_post_efi.log cp -pr /boot/efi/EFI/almalinux/* /boot/efi/EFI/BOOT/ -# delete libvirt -systemctl stop libvirtd -systemctl disable libvirtd %end #reboot diff --git a/extra/files/gen2-linux/ansible.sh b/extra/files/gen2-linux/ansible.sh index 83a52a2..91ec155 100755 --- a/extra/files/gen2-linux/ansible.sh +++ b/extra/files/gen2-linux/ansible.sh @@ -45,13 +45,13 @@ function install_ansible { /usr/bin/python3 -m pip install --upgrade jmespath jsonlint yamllint ansible-core==2.11.11 ansible pywinrm requests-kerberos requests-ntlm requests-credssp pypsrp ;; "8") echo "Found os: $OS and release: $VERSION_ID" - /usr/bin/python3 -m pip install --upgrade jmespath jsonlint yamllint ansible-core==$ansible_core ansible pywinrm requests-kerberos requests-ntlm requests-credssp pypsrp ;; + /usr/bin/python3 -m pip install --upgrade jmespath jsonlint yamllint ansible pywinrm requests-kerberos requests-ntlm requests-credssp pypsrp ;; "9") echo "Found os: $OS and release: $VERSION_ID" - /usr/bin/python3 -m pip install --upgrade jmespath jsonlint yamllint ansible-core==$ansible_core ansible pywinrm requests-kerberos requests-ntlm requests-credssp pypsrp ;; + /usr/bin/python3 -m pip install --upgrade jmespath jsonlint yamllint ansible pywinrm requests-kerberos requests-ntlm requests-credssp pypsrp ;; *) echo "Found os: $OS and release: $VERSION_ID" - /usr/bin/python3 -m pip install --upgrade jmespath jsonlint yamllint ansible-core==$ansible_core ansible pywinrm requests-kerberos requests-ntlm requests-credssp pypsrp ;; + /usr/bin/python3 -m pip install --upgrade jmespath jsonlint yamllint ansible pywinrm requests-kerberos requests-ntlm requests-credssp pypsrp ;; esac # build a block to supress warnings and other ansible configs mkdir -p /etc/ansible && chmod 755 /etc/ansible @@ -123,6 +123,8 @@ if [ "$INSTALL" == "false" ] && [[ "$OS" =~ rhel|centos|fedora ]];then $manager clean all -y $manager makecache -y /usr/bin/python3 -m pip uninstall jmespath jsonlint yamllint ansible-core ansible setuptools-rust pywinrm requests-kerberos requests-ntlm requests-credssp pypsrp -y + /usr/bin/python3 -m pip cache info + /usr/bin/python3 -m pip cache remove "*" rm -rf /root/.ansible||true rm -rf /root/.cache||true rm -rf /home/vagrant/.ansible||true @@ -148,6 +150,8 @@ if [ "$INSTALL" == "false" ] && [[ "$OS" =~ debian|ubuntu ]];then apt-get clean all -y apt-get update -y /usr/bin/python3 -m pip uninstall jmespath jsonlint yamllint ansible-core ansible pywinrm requests-kerberos requests-ntlm requests-credssp pypsrp -y + /usr/bin/python3 -m pip cache info + /usr/bin/python3 -m pip cache remove "*" rm -rf /root/.ansible||true rm -rf /root/.cache||true rm -rf /home/vagrant/.ansible||true diff --git a/extra/files/gen2-oraclelinux7/ks-kvm.cfg b/extra/files/gen2-oraclelinux7/ks-kvm.cfg new file mode 100644 index 0000000..10997e5 --- /dev/null +++ b/extra/files/gen2-oraclelinux7/ks-kvm.cfg @@ -0,0 +1,94 @@ +lang en_US +keyboard us +# Root password +rootpw $1$f0Hr84$whurdRGVEJbZs8QJJoWLB. --iscrypted +# Use network installation +#url --url="http://mirror.centos.org/centos/7/os/x86_64" +# Use cdrom +cdrom +# System language +# Firewall configuration +firewall --disabled +# +# System authorization information +auth --passalgo=sha512 --useshadow +# Use graphical install +# graphical +# Use text install +text +# Run the Setup Agent on first boot +firstboot --disable +# SELinux configuration +selinux --disabled +# License agreement +eula --agreed + +#X-window +skipx + +# System services +services --enabled="chronyd" +services --enabled="sshd" +services --enabled="NetworkManager" + +# Network information +network --bootproto=dhcp --noipv6 --activate +# Reboot after installation +reboot +# System timezone +timezone Etc/UTC --isUtc +# System bootloader configuration +bootloader --append="rhgb quiet crashkernel=auto" +# Clear the Master Boot Record +zerombr +# Partition clearing information +clearpart --all --initlabel +# Disk partitioning information +part /boot --fstype="ext4" --size=2048 +part swap --fstype="swap" --size=8192 + +part pv.01 --size=1 --grow +volgroup vg_root pv.01 +logvol / --vgname=vg_root --size=1 --grow --name=lv_root +logvol /var --vgname=vg_root --size=8192 --name=lv_var + +# pre part +%pre + +%end + +# post part +%post --log=/var/log/anaconda/kickstart_post.log +systemctl enable sshd +# systemctl start sshd +systemctl set-default multi-user.target +systemctl disable initial-setup-text +systemctl disable initial-setup-graphical +sed -i 's/__all__ = \["EULAspoke"\]/__all__ = \["LicenseScreen"\]/' /usr/lib/python2.7/site-packages/initial_setup/tui/spokes/eula.py +%end + +%packages +@base +@compat-libraries +@core +@guest-agents +@input-methods +@network-file-system-client +@performance +chrony +mc +curl +wget +yum-versionlock +yum-utils +yum-cron +openssh-server +openssh-clients +openssh +kernel-devel +kernel-headers +make +patch +gcc +spice-vdagent +%end diff --git a/extra/files/gen2-oraclelinux8/ks-kvm.cfg b/extra/files/gen2-oraclelinux8/ks-kvm.cfg new file mode 100644 index 0000000..16bb357 --- /dev/null +++ b/extra/files/gen2-oraclelinux8/ks-kvm.cfg @@ -0,0 +1,110 @@ +#version=RHEL8 +# X Window System configuration information +#xconfig --startxonboot +# License agreement +eula --agreed +# Use graphical install +text +# SELinux configuration +selinux --disabled +# Network information +network --bootproto=dhcp --noipv6 --activate +#network --bootproto=dhcp --hostname=localhost.localdomain +# firewall +firewall --disabled + +#ignoredisk --only-use=sda +# 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 +#autopart --type=lvm +zerombr +# Partition clearing information +clearpart --all --initlabel +# Disk partitioning information + +#Disk partitioning information +part /boot --fstype="ext4" --size=2048 +part swap --fstype="swap" --size=8192 + +part pv.01 --size=1 --grow +volgroup vg_root pv.01 +logvol / --vgname=vg_root --size=1 --grow --name=lv_root +logvol /var --vgname=vg_root --size=8192 --name=lv_var + + +%packages +@guest-agents +qemu-guest-agent +#@headless-management +@legacy-unix +@system-tools +mc +curl +wget +tar +bzip2 +kernel-devel +kernel-headers +kernel-uek-devel +perl +gcc +make +elfutils-libelf-devel +langpacks-en +glibc-all-langpacks +openssh-server +openssh-clients +openssh +python3-pip +python3-setuptools +spice-vdagent +%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 \ No newline at end of file diff --git a/extra/files/gen2-oraclelinux9/ks-kvm.cfg b/extra/files/gen2-oraclelinux9/ks-kvm.cfg new file mode 100644 index 0000000..8b038ed --- /dev/null +++ b/extra/files/gen2-oraclelinux9/ks-kvm.cfg @@ -0,0 +1,106 @@ +#version=RHEL9 +# X Window System configuration information +#xconfig --startxonboot +# License agreement +eula --agreed +# Use graphical install +text +# SELinux configuration +selinux --disabled +# Network information +network --bootproto=dhcp --noipv6 --activate +#network --bootproto=dhcp --hostname=localhost.localdomain +# firewall +firewall --disabled + +#ignoredisk --only-use=sda +# 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 --utc +# System bootloader configuration +bootloader --location=mbr +#autopart --type=lvm +zerombr +# Partition clearing information +clearpart --all --initlabel +# Disk partitioning information + +#Disk partitioning information +part /boot --fstype="ext4" --size=2048 +part swap --fstype="swap" --size=8192 + +part pv.01 --size=1 --grow +volgroup vg_root pv.01 +logvol / --vgname=vg_root --size=1 --grow --name=lv_root +logvol /var --vgname=vg_root --size=8192 --name=lv_var + + +%packages +@guest-agents +qemu-guest-agent +@legacy-unix +@system-tools +mc +curl +wget +tar +bzip2 +kernel-devel +kernel-headers +kernel-uek-devel +perl +gcc +make +elfutils-libelf-devel +langpacks-en +glibc-all-langpacks +openssh-server +openssh-clients +openssh +python3-pip +python3-setuptools +tuned +tuned-profiles-atomic +spice-vdagent +%end + +%addon com_redhat_subscription_manager +%end +%addon ADDON_placeholder --disable --reserve-mb=auto +%end +%addon com_redhat_kdump --disable +%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 part +%post --log=/var/log/anaconda/kickstart_post.log +systemctl enable qemu-guest-agent +systemctl set-default multi-user.target +%end + +#reboot +reboot \ No newline at end of file diff --git a/extra/files/gen2-oraclelinux9/ks.cfg b/extra/files/gen2-oraclelinux9/ks.cfg index e4343ed..45994d4 100644 --- a/extra/files/gen2-oraclelinux9/ks.cfg +++ b/extra/files/gen2-oraclelinux9/ks.cfg @@ -1,6 +1,5 @@ #version=RHEL8 # X Window System configuration information -xconfig --startxonboot # License agreement eula --agreed # Use graphical install @@ -8,7 +7,7 @@ text # SELinux configuration selinux --disabled # Network information -ignoredisk --only-use=sda +network --bootproto=dhcp --noipv6 --activate # Use CDROM installation media cdrom # Run the Setup Agent on first boot @@ -25,9 +24,9 @@ lang en_US --addsupport=en_GB.UTF-8 repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream # Root password -rootpw --iscrypted $6$kivIgMEEjORaheG3$MTEQUVvZE0744qxUdXrSXfs/ePGYOVNGJv9aXVUyXRCiX3oizj69RF5Rw17npKPiltKgdepk0yO8/gzJQ2Se6/ +rootpw --plaintext password # System timezone -timezone Europe/Warsaw --utc +timezone UTC --utc # System bootloader configuration bootloader #autopart --type=lvm @@ -35,14 +34,13 @@ zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information -part /boot/efi --fstype="vfat" --size=200 -part /boot --fstype="ext4" --size=1024 -part swap --fstype="swap" --size=16384 +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 -@headless-management @legacy-unix @system-tools bash @@ -73,21 +71,22 @@ tuned-profiles-atomic %end # post part -%post +%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 -sed -ri 's/^UsePAM yes/UsePAM no/' /etc/ssh/sshd_config systemctl enable sshd +%end + +# post part +%post --log=/var/log/anaconda/kickstart_post.log +systemctl enable qemu-guest-agent systemctl set-default multi-user.target -systemctl disable initial-setup-text -systemctl disable initial-setup-graphical -initial_setup/tui/spokes/eula.py -# +%end + +# post part +%post --log=/var/log/anaconda/kickstart_post_efi.log cp -pr /boot/efi/EFI/oraclelinux/* /boot/efi/EFI/BOOT/ -# delete libvirt -systemctl stop libvirtd -systemctl disable libvirtd %end #reboot diff --git a/extra/files/gen2-oraclelinux9/uefi.sh b/extra/files/gen2-oraclelinux9/uefi.sh index b7941cf..258d24f 100644 --- a/extra/files/gen2-oraclelinux9/uefi.sh +++ b/extra/files/gen2-oraclelinux9/uefi.sh @@ -2,16 +2,16 @@ # try to deal with broken centos UEFI in Hyper-V # Let's find out which bootnumber we have currently in UEFI with CentOS label -bootnum=$(efibootmgr -v|grep -i centos|awk '{print $1}'|cut -c5-8) +bootnum=$(efibootmgr -v|grep -i oracle|awk '{print $1}'|cut -c5-8) -if [ -d "/boot/efi/EFI/centos" ]; then - echo "Centos exists" +if [ -d "/boot/efi/EFI/oracle" ]; then + echo "Oracle exists" # cp -av /boot/efi/EFI/centos/. /boot/efi/EFI/BOOT/ # now centos exists if [ -z "$bootnum" ]; then - echo "Current CentOS boot number equals: $bootnum" + echo "Current Oracle boot number equals: $bootnum" efibootmgr -b "$bootnum" -B - efibootmgr --create --label CentOS --disk /dev/sda1 --loader "\EFI\centos\shim.efi" + efibootmgr --create --label OracleLinux --disk /dev/sda1 --loader "\EFI\oracle\shim.efi" sudo grub2-mkconfig -o /boot/efi/EFI/BOOT/grub.cfg efibootmgr -v fi diff --git a/extra/files/gen2-rhel7/ks-kvm.cfg b/extra/files/gen2-rhel7/ks-kvm.cfg new file mode 100644 index 0000000..b902500 --- /dev/null +++ b/extra/files/gen2-rhel7/ks-kvm.cfg @@ -0,0 +1,98 @@ +lang en_US +keyboard us +# Root password +rootpw $1$f0Hr84$whurdRGVEJbZs8QJJoWLB. --iscrypted +# Use network installation +#url --url="http://mirror.centos.org/centos/7/os/x86_64" +# Use cdrom +cdrom +# System language +# Firewall configuration +firewall --disabled +# +# System authorization information +auth --passalgo=sha512 --useshadow +# Use graphical install +# graphical +# Use text install +text +# Run the Setup Agent on first boot +firstboot --disable +# SELinux configuration +selinux --disabled +# License agreement +eula --agreed + +#X-window +skipx + +# System services +services --enabled="chronyd" +services --enabled="sshd" +services --enabled="NetworkManager" + +# Network information +network --bootproto=dhcp --noipv6 --activate +# Reboot after installation +reboot +# System timezone +timezone Etc/UTC --isUtc +# System bootloader configuration +bootloader --append="rhgb quiet crashkernel=auto" +# Clear the Master Boot Record +zerombr +# Partition clearing information +clearpart --all --initlabel +# Disk partitioning information +part /boot --fstype="ext4" --size=2048 +part swap --fstype="swap" --size=8192 + +part pv.01 --size=1 --grow +volgroup vg_root pv.01 +logvol / --vgname=vg_root --size=1 --grow --name=lv_root +logvol /var --vgname=vg_root --size=8192 --name=lv_var + +# pre part +%pre + +%end + +# post part +%post --log=/var/log/anaconda/kickstart_post.log +systemctl enable sshd +# systemctl start sshd +systemctl set-default multi-user.target +systemctl disable initial-setup-text +systemctl disable initial-setup-graphical +sed -i 's/__all__ = \["EULAspoke"\]/__all__ = \["LicenseScreen"\]/' /usr/lib/python2.7/site-packages/initial_setup/tui/spokes/eula.py +%end + +%packages +@base +@compat-libraries +@core +@guest-agents +@input-methods +@network-file-system-client +@performance +chrony +mc +curl +wget +yum-versionlock +yum-utils +yum-cron +openssh-server +openssh-clients +openssh +kernel-devel +kernel-headers +make +patch +gcc +spice-vdagent +cloud-init +cloud-utils-growpart +gdb +git +%end diff --git a/extra/files/gen2-rockylinux8/ks-kvm.cfg b/extra/files/gen2-rockylinux8/ks-kvm.cfg new file mode 100644 index 0000000..4b87cb3 --- /dev/null +++ b/extra/files/gen2-rockylinux8/ks-kvm.cfg @@ -0,0 +1,106 @@ +#version=RHEL8 +# X Window System configuration information +# xconfig --startxonboot +# License agreement +eula --agreed +# Use graphical install +text +# SELinux configuration +selinux --disabled +# Network information +network --bootproto=dhcp --noipv6 --activate +#network --bootproto=dhcp --hostname=localhost.localdomain +# firewall +firewall --disabled + +#ignoredisk --only-use=sda +# 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 --iscrypted $6$kivIgMEEjORaheG3$MTEQUVvZE0744qxUdXrSXfs/ePGYOVNGJv9aXVUyXRCiX3oizj69RF5Rw17npKPiltKgdepk0yO8/gzJQ2Se6/ +# System timezone +timezone UTC --isUtc --ntpservers=0.rhel.pool.ntp.org +# System bootloader configuration +bootloader --location=mbr +#autopart --type=lvm +zerombr +# Partition clearing information +clearpart --all --initlabel +# Disk partitioning information +part /boot/efi --fstype="vfat" --size=200 +part /boot --fstype="ext4" --size=1024 +part swap --fstype="swap" --size=16384 +part / --fstype="ext4" --grow --size=1 + +%packages +@guest-agents +@headless-management +@legacy-unix +@system-tools +mc +curl +wget +tar +bzip2 +kernel-devel +kernel-headers +perl +gcc +make +elfutils-libelf-devel +langpacks-en +glibc-all-langpacks +openssh-server +openssh-clients +openssh +python3-pip +python3-setuptools +spice-vdagent +%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 +#cp -pr /boot/efi/EFI/rockylinux/* /boot/efi/EFI/BOOT/ +# delete libvirt +systemctl stop libvirtd +systemctl disable libvirtd +%end + +#reboot +reboot \ No newline at end of file diff --git a/extra/files/gen2-rockylinux9/ks.cfg b/extra/files/gen2-rockylinux9/ks.cfg index 82fdaee..3800581 100644 --- a/extra/files/gen2-rockylinux9/ks.cfg +++ b/extra/files/gen2-rockylinux9/ks.cfg @@ -1,6 +1,6 @@ #version=RHEL9 # X Window System configuration information -xconfig --startxonboot +#xconfig --startxonboot # License agreement eula --agreed # Use graphical install @@ -8,7 +8,7 @@ text # SELinux configuration selinux --disabled # Network information -ignoredisk --only-use=sda +network --bootproto=dhcp --noipv6 --activate # Use CDROM installation media cdrom # Run the Setup Agent on first boot @@ -25,9 +25,9 @@ lang en_US --addsupport=en_GB.UTF-8 repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream # Root password -rootpw --iscrypted $6$v1A3VJeCQtb3E5pD$pegFkSe75oeG8L9JaOjI9DYlWPYMV2V94xELjOThdt4u36eBsQFnDXEkqBMVXT9OJRzd2xwXvMy7xqVVM6UlV1 +rootpw --plaintext password # System timezone -timezone Europe/Warsaw --utc +timezone UTC --utc # System bootloader configuration # bootloader --location=mbr --boot-drive=sda bootloader @@ -36,14 +36,13 @@ zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information -part /boot/efi --fstype="vfat" --size=200 -part /boot --fstype="ext4" --size=1024 -part swap --fstype="swap" --size=16384 +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 -@headless-management @legacy-unix @system-tools bash @@ -65,6 +64,7 @@ openssh-clients openssh tuned tuned-profiles-atomic +spice-vdagent %end %addon com_redhat_subscription_manager @@ -73,21 +73,21 @@ tuned-profiles-atomic %end # post part -%post +%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 -sed -ri 's/^UsePAM yes/UsePAM no/' /etc/ssh/sshd_config systemctl enable sshd +%end + +# post part +%post --log=/var/log/anaconda/kickstart_post.log +systemctl enable qemu-guest-agent systemctl set-default multi-user.target -systemctl disable initial-setup-text -systemctl disable initial-setup-graphical -initial_setup/tui/spokes/eula.py -# +%end + +%post --log=/var/log/anaconda/kickstart_post_efi.log cp -pr /boot/efi/EFI/rockylinux/* /boot/efi/EFI/BOOT/ -# delete libvirt -systemctl stop libvirtd -systemctl disable libvirtd %end #reboot diff --git a/extra/playbooks/provision_alma8_variables.yml b/extra/playbooks/provision_alma8_variables.yml index f66443b..8146dd5 100644 --- a/extra/playbooks/provision_alma8_variables.yml +++ b/extra/playbooks/provision_alma8_variables.yml @@ -113,7 +113,7 @@ neofetch: options: - option: (\s*[^#]info "Packages" packages).* line: ' #info "Packages" packages' -timezone: "Europe/Copenhagen" +timezone: "UTC" remote_files: - url: https://raw.githubusercontent.com/marcinbojko/hv-packer/master/extra/files/gen2-linux/prepare_neofetch.sh dest: /tmp/prepare_neofetch.sh diff --git a/extra/playbooks/provision_alma9_variables.yml b/extra/playbooks/provision_alma9_variables.yml index c3d189e..42d4e69 100644 --- a/extra/playbooks/provision_alma9_variables.yml +++ b/extra/playbooks/provision_alma9_variables.yml @@ -114,7 +114,7 @@ neofetch: options: - option: (\s*[^#]info "Packages" packages).* line: ' #info "Packages" packages' -timezone: "Europe/Copenhagen" +timezone: "UTC" remote_files: - url: https://raw.githubusercontent.com/marcinbojko/hv-packer/master/extra/files/gen2-linux/prepare_neofetch.sh dest: /tmp/prepare_neofetch.sh diff --git a/extra/playbooks/provision_centos.yaml b/extra/playbooks/provision_centos.yaml index 2948ba2..550d8b6 100644 --- a/extra/playbooks/provision_centos.yaml +++ b/extra/playbooks/provision_centos.yaml @@ -51,6 +51,11 @@ register: freespace tags: - assert + - name: fact_release + ansible.builtin.set_fact: + release: "{{ ansible_distribution_major_version }}" + changed_when: false + ignore_errors: false tasks: - name: display_initial_values ansible.builtin.debug: @@ -111,7 +116,7 @@ section: "{{ epel.section }} | default ('epel')" option: enabled value: "1" - mode: 0644 + mode: "0644" retries: "{{ retries_count }}" delay: "{{ delay_time }}" when: r_install_epel is success and install_epel @@ -127,7 +132,7 @@ section: epel option: priority value: "{{ epel.priority | int }}" - mode: 0644 + mode: "0644" retries: "{{ retries_count }}" delay: "{{ delay_time }}" when: r_install_epel is success and r_enable_epel is success and install_epel @@ -219,6 +224,7 @@ # start zabbix block - name: start_zabbix_block + when: install_zabbix block: - name: import_gpg_zabix_key ansible.builtin.rpm_key: @@ -245,7 +251,7 @@ section: zabbix-non-supported option: enabled value: "0" - mode: 0644 + mode: "0644" when: r_zabbix_repository is success retries: "{{ retries_count }}" delay: "{{ delay_time }}" @@ -257,7 +263,7 @@ section: "{{ item.name }}" option: "priority" value: "{{ item.priority }}" - mode: 0644 + mode: "0644" when: r_zabbix_repository is success retries: "{{ retries_count }}" delay: "{{ delay_time }}" @@ -287,6 +293,7 @@ [Service] User=root Group=root + mode: "0644" when: install_zabbix_as_root is defined and install_zabbix_as_root - name: start_zabbix ansible.builtin.systemd: @@ -300,8 +307,9 @@ until: r_start_zabbix is success when: r_zabbix_package is success changed_when: false - when: install_zabbix + - name: start_cockpit_block + when: install_cockpit is defined and install_cockpit block: - name: install_cockpit ansible.builtin.package: @@ -316,9 +324,10 @@ delay: "{{ delay_time }}" retries: "{{ retries_count }}" until: r_start_cockpit is success - when: install_cockpit is defined and install_cockpit + # start puppet block - name: start_puppet_block + when: install_puppet block: - name: import_gpg_puppet_key ansible.builtin.rpm_key: @@ -344,7 +353,7 @@ section: "{{ item.name }}" option: "priority" value: "{{ item.priority }}" - mode: 0644 + mode: "0644" when: r_puppet_repository is success retries: "{{ retries_count }}" delay: "{{ delay_time }}" @@ -399,16 +408,17 @@ section: main option: "{{ item.key }}" value: "{{ item.value }}" - mode: 0644 + mode: "0644" loop: "{{ puppet.config.agent }}" register: r_add_puppet_config_options retries: "{{ retries_count }}" delay: "{{ delay_time }}" until: r_add_puppet_config_options is success when: r_install_puppet_package is success - when: install_puppet + # start neofetch block - requires changes from script to 'per option' settings - name: start_neofetch_block + when: install_neofetch block: - name: add_neofetch_repository ansible.builtin.get_url: @@ -435,8 +445,9 @@ ansible.builtin.command: neofetch when: r_neofetch_repository is success changed_when: false - ignore_errors: true +# ignore_errors: true any_errors_fatal: false + failed_when: false - name: create_config_folder ansible.builtin.file: path: /etc/neofetch @@ -452,8 +463,8 @@ src: /root/.config/neofetch/config.conf dest: /etc/neofetch/config.conf remote_src: true - mode: 0755 - force: no + mode: "0755" + force: false retries: "{{ retries_count }}" delay: "{{ delay_time }}" register: r_copy_neofetch_config @@ -478,11 +489,10 @@ # run neofetch script - to be replaced - name: run_prepare_neofetch ansible.builtin.shell: chmod +x /tmp/prepare_neofetch.sh; sh /tmp/prepare_neofetch.sh - args: - warn: false when: install_neofetch and (r_install_neofetch_package is success and r_install_neofetch_package is defined) - when: install_neofetch + changed_when: false - name: start_hyperv_block + when: install_hyperv block: - name: install_hyperv ansible.builtin.package: @@ -502,12 +512,12 @@ - name: create_ballooning rule ansible.builtin.copy: dest: /etc/udev/rules.d/100-balloon.rules - mode: 0644 + mode: "0644" content: | SUBSYSTEM=="memory", ACTION=="add", ATTR{state}="online" when: (r_install_hyperv_package is success and r_install_hyperv_package is defined) and (r_enable_hyperv_services is success and r_enable_hyperv_services is defined) - when: install_hyperv - name: start_extra_device_block + when: docker_prepare block: - name: check_for_device_existence ansible.builtin.stat: @@ -546,18 +556,18 @@ ansible.builtin.file: name: /var/lib/docker state: directory - mode: 0644 + mode: "0644" when: (r_create_docker_filesystem is defined and r_create_docker_filesystem is success) - name: mount_extra_volume ansible.posix.mount: path: /var/lib/docker - src: "UUID={{ ansible_devices[extra_device].partitions[extra_device + '1'].uuid }}" + src: "UUID={{ ansible_devices[extra_device].partitions[extra_device + '1'].uuid }}" fstype: ext4 opts: defaults state: mounted boot: true when: (ansible_devices[extra_device].partitions[extra_device + '1'].uuid | length > 5) and (r_partition_docker_volume is success and r_partition_docker_volume is defined) - when: docker_prepare + # os related block - name: start_os_related_block block: @@ -575,7 +585,7 @@ changed_when: false # set timezone - name: set_timezone - community.general.system.timezone: + community.general.timezone: name: "{{ timezone }}" retries: "{{ retries_count }}" delay: "{{ delay_time }}" @@ -584,9 +594,9 @@ - name: create_motd ansible.builtin.copy: dest: /etc/profile.d/motd.sh - mode: 0755 + mode: "0755" content: "{{ motd }}" - force: no + force: false when: install_motd and (r_install_neofetch_package is success and r_install_neofetch_package is defined) - name: update_all_packages ansible.builtin.package: @@ -783,48 +793,72 @@ register: r_set_tuned until: r_set_tuned is success when: machine_type != "guest" and machine_type is defined + changed_when: false - name: update_rkhunter ansible.builtin.command: rkhunter --propupd - ignore_errors: true + failed_when: false any_errors_fatal: false changed_when: false - name: get_info_from_grubby ansible.builtin.command: grubby --info=ALL register: r_grubby_info any_errors_fatal: false - ignore_errors: true + failed_when: false changed_when: false until: r_grubby_info is success when: (install_docker_workaround is defined and install_docker_workaround) or (install_kubernetes_workaround is defined and install_kubernetes_workaround) - name: update_grub_fsck_options_for_all_machines ansible.builtin.command: grubby --args "fsck.repair=yes" --update-kernel=ALL when: (install_docker_workaround is defined and install_docker_workaround) and ("fsck.repair=yes" not in r_grubby_info.stdout) + changed_when: false + failed_when: false - name: update_grub_accounting_options_for_kubernetes ansible.builtin.command: grubby --args "cgroup.memory=nokmem" --update-kernel=ALL when: (install_kubernetes_workaround is defined and install_kubernetes_workaround) and (r_grubby_info is defined and "cgroup.memory=nokmem" not in r_grubby_info.stdout) + changed_when: false + failed_when: false + # cleanup kernels in post 8 releases + - name: cleanup_kernels_post_8 + ansible.builtin.shell: "dnf -y remove --oldinstallonly --setopt installonly_limit=2 kernel|| true" + register: r_cleanup_kernels_post_8 + retries: "{{ retries_count }}" + delay: "{{ delay_time }}" + until: r_cleanup_kernels_post_8 is success + when: release is defined and release | int > 7 + changed_when: false + ignore_errors: true + any_errors_fatal: false + - name: cleanup_kernels_7 + ansible.builtin.command: "package-cleanup --oldkernels --count=2 -y -v" + register: r_cleanup_kernels_7 + retries: "{{ retries_count }}" + delay: "{{ delay_time }}" + until: r_cleanup_kernels_7 is success + when: release is defined and release | int < 8 + changed_when: false + ignore_errors: true + any_errors_fatal: false # create stampfile - name: create_stampfile ansible.builtin.copy: dest: "/etc/packerinfo" - mode: 0644 + mode: "0644" content: | { "creationDate": "{{ ansible_date_time.date }}" } # let's clean logs and leftovers - name: cleaning_stuff ansible.builtin.shell: | - package-cleanup --oldkernels --count=2 -y -v truncate -s 0 /var/log/* truncate -s 0 -c /var/log/**/* find /var/log -type f -name \"*.[0-99].gz\" -exec rm {} + + rm -rfv /etc/ansible/* rm -rfv /var/log/anaconda/* rm -rfv /var/cache/libvirt/* rm -rfv /var/cache/powertop/* rm -rfv /var/crash/* rm -rfv /var/tmp/* - args: - warn: false any_errors_fatal: false - ignore_errors: true + failed_when: false changed_when: false notify: - clean-metadata diff --git a/extra/playbooks/provision_centos7_variables.yml b/extra/playbooks/provision_centos7_variables.yml index 34fb07f..1e8f897 100644 --- a/extra/playbooks/provision_centos7_variables.yml +++ b/extra/playbooks/provision_centos7_variables.yml @@ -114,7 +114,7 @@ neofetch: options: - option: (\s*[^#]info "Packages" packages).* line: ' #info "Packages" packages' -timezone: "Europe/Copenhagen" +timezone: "UTC" remote_files: - url: https://raw.githubusercontent.com/marcinbojko/hv-packer/master/extra/files/gen2-linux/prepare_neofetch.sh dest: /tmp/prepare_neofetch.sh diff --git a/extra/playbooks/provision_centos8_variables.yml b/extra/playbooks/provision_centos8_variables.yml index e3cc39c..71c3cf7 100644 --- a/extra/playbooks/provision_centos8_variables.yml +++ b/extra/playbooks/provision_centos8_variables.yml @@ -113,7 +113,7 @@ neofetch: options: - option: (\s*[^#]info "Packages" packages).* line: ' #info "Packages" packages' -timezone: "Europe/Copenhagen" +timezone: "UTC" remote_files: - url: https://raw.githubusercontent.com/marcinbojko/hv-packer/master/extra/files/gen2-linux/prepare_neofetch.sh dest: /tmp/prepare_neofetch.sh diff --git a/extra/playbooks/provision_oracle8_variables.yml b/extra/playbooks/provision_oracle8_variables.yml index 914a62c..27a5bf1 100644 --- a/extra/playbooks/provision_oracle8_variables.yml +++ b/extra/playbooks/provision_oracle8_variables.yml @@ -113,7 +113,7 @@ neofetch: options: - option: (\s*[^#]info "Packages" packages).* line: ' #info "Packages" packages' -timezone: "Europe/Copenhagen" +timezone: "UTC" remote_files: - url: https://raw.githubusercontent.com/marcinbojko/hv-packer/master/extra/files/gen2-linux/prepare_neofetch.sh dest: /tmp/prepare_neofetch.sh diff --git a/extra/playbooks/provision_oracle9_variables.yml b/extra/playbooks/provision_oracle9_variables.yml index f2dc52d..903c668 100644 --- a/extra/playbooks/provision_oracle9_variables.yml +++ b/extra/playbooks/provision_oracle9_variables.yml @@ -114,7 +114,7 @@ neofetch: options: - option: (\s*[^#]info "Packages" packages).* line: ' #info "Packages" packages' -timezone: "Europe/Copenhagen" +timezone: "UTC" remote_files: - url: https://raw.githubusercontent.com/marcinbojko/hv-packer/master/extra/files/gen2-linux/prepare_neofetch.sh dest: /tmp/prepare_neofetch.sh diff --git a/extra/playbooks/provision_rocky8_variables.yml b/extra/playbooks/provision_rocky8_variables.yml index f66443b..8146dd5 100644 --- a/extra/playbooks/provision_rocky8_variables.yml +++ b/extra/playbooks/provision_rocky8_variables.yml @@ -113,7 +113,7 @@ neofetch: options: - option: (\s*[^#]info "Packages" packages).* line: ' #info "Packages" packages' -timezone: "Europe/Copenhagen" +timezone: "UTC" remote_files: - url: https://raw.githubusercontent.com/marcinbojko/hv-packer/master/extra/files/gen2-linux/prepare_neofetch.sh dest: /tmp/prepare_neofetch.sh diff --git a/extra/playbooks/provision_rocky9_variables.yml b/extra/playbooks/provision_rocky9_variables.yml index 408cd5c..8abc970 100644 --- a/extra/playbooks/provision_rocky9_variables.yml +++ b/extra/playbooks/provision_rocky9_variables.yml @@ -114,7 +114,7 @@ neofetch: options: - option: (\s*[^#]info "Packages" packages).* line: ' #info "Packages" packages' -timezone: "Europe/Copenhagen" +timezone: "UTC" remote_files: - url: https://raw.githubusercontent.com/marcinbojko/hv-packer/master/extra/files/gen2-linux/prepare_neofetch.sh dest: /tmp/prepare_neofetch.sh diff --git a/extra/scripts/phase-1.ps1 b/extra/scripts/phase-1.ps1 index 0536714..001daa0 100755 --- a/extra/scripts/phase-1.ps1 +++ b/extra/scripts/phase-1.ps1 @@ -20,8 +20,8 @@ $version=(Get-WMIObject win32_operatingsystem).name printWindowsVersion } '(Server 2022)' { - $global:os="2022" - printWindowsVersion + $global:os="2022" + printWindowsVersion } '(Microsoft Windows Server Standard|Microsoft Windows Server Datacenter)'{ $ws_version=(Get-WmiObject win32_operatingsystem).buildnumber @@ -176,8 +176,16 @@ if (-not $choco_install_success) { exit (1) } - - +# Install PSWindowsUpdate +Write-Output "Phase 1 [INFO] - Installing Nuget" +Get-PackageProvider -Name "Nuget" -ForceBootstrap -Verbose -ErrorAction Stop +Write-Output "Phase 1 [INFO] - Installing PSWindowsUpdate" +Install-Module PSWindowsUpdate -Force -Confirm:$false -Verbose -ErrorAction Stop +Import-Module PSWindowsUpdate +Get-WUServiceManager +if ($global:os -ne '2022') { + Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d -Confirm:$false +} #Remove 260 Character Path Limit if (Test-Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem') { Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -name "LongPathsEnabled" -Value 1 -Verbose -Force diff --git a/extra/scripts/phase-3.ps1 b/extra/scripts/phase-3.ps1 index fd69ac8..1b694fb 100755 --- a/extra/scripts/phase-3.ps1 +++ b/extra/scripts/phase-3.ps1 @@ -4,7 +4,7 @@ param( [Parameter()] [ValidateNotNullOrEmpty()] - [string]$Version="7.14.0", + [string]$Version="7.21.0", [Parameter()] [ValidateNotNullOrEmpty()] [ValidateSet('true','false','$true','$false','0','1')] diff --git a/extra/scripts/phase-4.windows-updates.ps1 b/extra/scripts/phase-4.windows-updates.ps1 index 5dbaf01..edd58a1 100755 --- a/extra/scripts/phase-4.windows-updates.ps1 +++ b/extra/scripts/phase-4.windows-updates.ps1 @@ -2,6 +2,10 @@ #install Windows Updates # For test run disable updates # exit +param ( + # when set to true, the script will not actually install any updates + [bool] $SkipUpdates = $False +) $global:os="" function whichWindows { $version=(Get-WMIObject win32_operatingsystem).name @@ -104,7 +108,13 @@ whichWindows } try { Write-Output "Phase-4 [INFO] - Updates pass started" - Install-WindowsUpdate -AcceptAll -IgnoreReboot -ErrorAction SilentlyContinue + if ($SkipUpdates) { + Write-Output "Phase-4 [INFO] - Skipping updates as $skipUpdates is set to true" + } + else { + Write-Output "Phase-4 [INFO] - Installing updates" + Install-WindowsUpdate -AcceptAll -IgnoreReboot -Verbose -ErrorAction SilentlyContinue + } #Get-WUHistory Write-Output "Phase-4 [INFO] - Updates pass completed" } diff --git a/hv_almalinux92.ps1 b/hv_almalinux92.ps1 new file mode 100644 index 0000000..a1958d7 --- /dev/null +++ b/hv_almalinux92.ps1 @@ -0,0 +1,39 @@ +# Build images + +# Get Start Time +$startDTM = (Get-Date) + +# Variables +$template_file="./templates/hv_almalinux9_g2.pkr.hcl" +$var_file="./variables/variables_almalinux92.pkvars.hcl" +$machine="AlmaLinux 9.2" +$packer_log=0 + +if ((Test-Path -Path "$template_file") -and (Test-Path -Path "$var_file")) { + Write-Output "Template and var file found" + Write-Output "Building: $machine" + try { + $env:PACKER_LOG=$packer_log + packer validate -var-file="$var_file" "$template_file" + } + catch { + Write-Output "Packer validation failed, exiting." + exit (-1) + } + try { + $env:PACKER_LOG=$packer_log + packer version + packer build --force -var-file="$var_file" "$template_file" + } + catch { + Write-Output "Packer build failed, exiting." + exit (-1) + } +} +else { + Write-Output "Template or Var file not found - exiting" + exit (-1) +} + +$endDTM = (Get-Date) +Write-Host "[INFO] - Elapsed Time: $(($endDTM-$startDTM).totalseconds) seconds" -ForegroundColor Yellow diff --git a/hv_almalinux92_docker.ps1 b/hv_almalinux92_docker.ps1 new file mode 100644 index 0000000..d2c6069 --- /dev/null +++ b/hv_almalinux92_docker.ps1 @@ -0,0 +1,40 @@ +# Build images + +# Get Start Time +$startDTM = (Get-Date) + +# Variables +$template_file="./templates/hv_almalinux9_g2_docker.pkr.hcl" +$var_file="./variables/variables_almalinux92.pkvars.hcl" +$override="./variables/almalinux9_docker.yml" +$machine="AlmaLinux 9.2" +$packer_log=0 + +if ((Test-Path -Path "$template_file") -and (Test-Path -Path "$var_file")) { + Write-Output "Template and var file found" + Write-Output "Building: $machine" + try { + $env:PACKER_LOG=$packer_log + packer validate -var-file="$var_file" -var "ansible_override=$override" "$template_file" + } + catch { + Write-Output "Packer validation failed, exiting." + exit (-1) + } + try { + $env:PACKER_LOG=$packer_log + packer version + packer build --force -var-file="$var_file" -var "ansible_override=$override" "$template_file" + } + catch { + Write-Output "Packer build failed, exiting." + exit (-1) + } +} +else { + Write-Output "Template or Var file not found - exiting" + exit (-1) +} + +$endDTM = (Get-Date) +Write-Host "[INFO] - Elapsed Time: $(($endDTM-$startDTM).totalseconds) seconds" -ForegroundColor Yellow diff --git a/hv_almalinux92_vagrant.ps1 b/hv_almalinux92_vagrant.ps1 new file mode 100644 index 0000000..5fcef4a --- /dev/null +++ b/hv_almalinux92_vagrant.ps1 @@ -0,0 +1,44 @@ +# Build images + +# Get Start Time +$startDTM = (Get-Date) + +# Variables +$template_file="./templates/hv_almalinux9_g2_vagrant.pkr.hcl" +$var_file="./variables/variables_almalinux92.pkvars.hcl" +$vbox_file="./vbox/packer-almalinux92-g2.box" +$machine="AlmaLinux 9.2" +$packer_log=0 + +if ((Test-Path -Path "$template_file") -and (Test-Path -Path "$var_file")) { + Write-Output "Template and var file found" + Write-Output "Building: $machine" + try { + $env:PACKER_LOG=$packer_log + packer validate -var-file="$var_file" "$template_file" + } + catch { + Write-Output "Packer validation failed, exiting." + exit (-1) + } + try { + $env:PACKER_LOG=$packer_log + packer version + packer build --force -var-file="$var_file" "$template_file" + if ($?) { + Write-Output "Calculating checksums" + Get-FileHash -Algorithm SHA256 -Path "$vbox_file"|Out-File "$vbox_file.sha256" -Verbose + } + } + catch { + Write-Output "Packer build failed, exiting." + exit (-1) + } +} +else { + Write-Output "Template or Var file not found - exiting" + exit (-1) +} + +$endDTM = (Get-Date) +Write-Host "[INFO] - Elapsed Time: $(($endDTM-$startDTM).totalseconds) seconds" -ForegroundColor Yellow diff --git a/hv_oraclelinux92.ps1 b/hv_oraclelinux92.ps1 new file mode 100644 index 0000000..784bb3e --- /dev/null +++ b/hv_oraclelinux92.ps1 @@ -0,0 +1,39 @@ +# Build images + +# Get Start Time +$startDTM = (Get-Date) + +# Variables +$template_file="./templates/hv_oraclelinux9_g2.pkr.hcl" +$var_file="./variables/variables_oraclelinux92.pkvars.hcl" +$machine="OracleLinux 9.2" +$packer_log=0 + +if ((Test-Path -Path "$template_file") -and (Test-Path -Path "$var_file")) { + Write-Output "Template and var file found" + Write-Output "Building: $machine" + try { + $env:PACKER_LOG=$packer_log + packer validate -var-file="$var_file" "$template_file" + } + catch { + Write-Output "Packer validation failed, exiting." + exit (-1) + } + try { + $env:PACKER_LOG=$packer_log + packer version + packer build --force -var-file="$var_file" "$template_file" + } + catch { + Write-Output "Packer build failed, exiting." + exit (-1) + } +} +else { + Write-Output "Template or Var file not found - exiting" + exit (-1) +} + +$endDTM = (Get-Date) +Write-Host "[INFO] - Elapsed Time: $(($endDTM-$startDTM).totalseconds) seconds" -ForegroundColor Yellow diff --git a/hv_oraclelinux92_docker.ps1 b/hv_oraclelinux92_docker.ps1 new file mode 100644 index 0000000..7faff81 --- /dev/null +++ b/hv_oraclelinux92_docker.ps1 @@ -0,0 +1,40 @@ +# Build images + +# Get Start Time +$startDTM = (Get-Date) + +# Variables +$template_file="./templates/hv_oraclelinux9_g2_docker.pkr.hcl" +$var_file="./variables/variables_oraclelinux92.pkvars.hcl" +$override="./variables/oraclelinux9_docker.yml" +$machine="OracleLinux 9.2" +$packer_log=0 + +if ((Test-Path -Path "$template_file") -and (Test-Path -Path "$var_file")) { + Write-Output "Template and var file found" + Write-Output "Building: $machine" + try { + $env:PACKER_LOG=$packer_log + packer validate -var-file="$var_file" -var "ansible_override=$override" "$template_file" + } + catch { + Write-Output "Packer validation failed, exiting." + exit (-1) + } + try { + $env:PACKER_LOG=$packer_log + packer version + packer build --force -var-file="$var_file" -var "ansible_override=$override" "$template_file" + } + catch { + Write-Output "Packer build failed, exiting." + exit (-1) + } +} +else { + Write-Output "Template or Var file not found - exiting" + exit (-1) +} + +$endDTM = (Get-Date) +Write-Host "[INFO] - Elapsed Time: $(($endDTM-$startDTM).totalseconds) seconds" -ForegroundColor Yellow diff --git a/hv_oraclelinux92_vagrant.ps1 b/hv_oraclelinux92_vagrant.ps1 new file mode 100644 index 0000000..ef76448 --- /dev/null +++ b/hv_oraclelinux92_vagrant.ps1 @@ -0,0 +1,44 @@ +# Build images + +# Get Start Time +$startDTM = (Get-Date) + +# Variables +$template_file="./templates/hv_oraclelinux9_g2_vagrant.pkr.hcl" +$var_file="./variables/variables_oraclelinux92.pkvars.hcl" +$vbox_file="./vbox/packer-oraclelinux92-g2.box" +$machine="OracleLinux 9.2" +$packer_log=0 + +if ((Test-Path -Path "$template_file") -and (Test-Path -Path "$var_file")) { + Write-Output "Template and var file found" + Write-Output "Building: $machine" + try { + $env:PACKER_LOG=$packer_log + packer validate -var-file="$var_file" "$template_file" + } + catch { + Write-Output "Packer validation failed, exiting." + exit (-1) + } + try { + $env:PACKER_LOG=$packer_log + packer version + packer build --force -var-file="$var_file" "$template_file" + if ($?) { + Write-Output "Calculating checksums" + Get-FileHash -Algorithm SHA256 -Path "$vbox_file"|Out-File "$vbox_file.sha256" -Verbose + } + } + catch { + Write-Output "Packer build failed, exiting." + exit (-1) + } +} +else { + Write-Output "Template or Var file not found - exiting" + exit (-1) +} + +$endDTM = (Get-Date) +Write-Host "[INFO] - Elapsed Time: $(($endDTM-$startDTM).totalseconds) seconds" -ForegroundColor Yellow diff --git a/hv_rockylinux91.ps1 b/hv_rockylinux92.ps1 similarity index 91% rename from hv_rockylinux91.ps1 rename to hv_rockylinux92.ps1 index 4c5c728..0ce8f34 100644 --- a/hv_rockylinux91.ps1 +++ b/hv_rockylinux92.ps1 @@ -5,8 +5,8 @@ $startDTM = (Get-Date) # Variables $template_file="./templates/hv_rockylinux9_g2.pkr.hcl" -$var_file="./variables/variables_rockylinux91.pkvars.hcl" -$machine="RockyLinux 9.1" +$var_file="./variables/variables_rockylinux92.pkvars.hcl" +$machine="RockyLinux 9.2" $packer_log=0 if ((Test-Path -Path "$template_file") -and (Test-Path -Path "$var_file")) { diff --git a/hv_rockylinux91_docker.ps1 b/hv_rockylinux92_docker.ps1 similarity index 94% rename from hv_rockylinux91_docker.ps1 rename to hv_rockylinux92_docker.ps1 index 54f8808..7204679 100644 --- a/hv_rockylinux91_docker.ps1 +++ b/hv_rockylinux92_docker.ps1 @@ -5,7 +5,7 @@ $startDTM = (Get-Date) # Variables $template_file="./templates/hv_rockylinux9_g2_docker.pkr.hcl" -$var_file="./variables/variables_rockylinux91.pkvars.hcl" +$var_file="./variables/variables_rockylinux92.pkvars.hcl" $override="./variables/rockylinux9_docker.yml" $machine="RockyLinux 9.1" $packer_log=0 diff --git a/hv_rockylinux91_vagrant.ps1 b/hv_rockylinux92_vagrant.ps1 similarity index 91% rename from hv_rockylinux91_vagrant.ps1 rename to hv_rockylinux92_vagrant.ps1 index 54eab14..5b01686 100644 --- a/hv_rockylinux91_vagrant.ps1 +++ b/hv_rockylinux92_vagrant.ps1 @@ -5,8 +5,8 @@ $startDTM = (Get-Date) # Variables $template_file="./templates/hv_rockylinux9_g2_vagrant.pkr.hcl" -$var_file="./variables/variables_rockylinux91.pkvars.hcl" -$vbox_file="./vbox/packer-rockylinux91-g2.box" +$var_file="./variables/variables_rockylinux92.pkvars.hcl" +$vbox_file="./vbox/packer-rockylinux92-g2.box" $machine="RockyLinux 9.1" $packer_log=0 diff --git a/templates/hv_almalinux9_g2.pkr.hcl b/templates/hv_almalinux9_g2.pkr.hcl new file mode 100644 index 0000000..e30d5bd --- /dev/null +++ b/templates/hv_almalinux9_g2.pkr.hcl @@ -0,0 +1,186 @@ + +variable "ansible_override" { + type = string + default = "" +} + +variable "boot_command" { + type = string + default = "" +} + +variable "disk_size" { + type = string + default = "70000" +} + +variable "disk_additional_size" { + type = list(number) + default = ["1024"] +} + +variable "memory" { + type = string + default = "1024" +} + +variable "cpus" { + type = string + default = "1" +} + +variable "iso_checksum" { + type = string + default = "" +} + +variable "iso_checksum_type" { + type = string + default = "" +} + +variable "iso_url" { + type = string + default = "" +} + +variable "output_directory" { + type = string + default = "" +} +variable "provision_script_options" { + type = string + default = "" +} +variable "output_vagrant" { + type = string + default = "" +} +variable "ssh_password" { + type = string + default = "" + sensitive = true +} + +variable "switch_name" { + type = string + default = "" +} + +variable "vagrantfile_template" { + type = string + default = "" +} + +variable "vlan_id" { + type = string + default = "" +} + +variable "vm_name" { + type = string + default = "" +} + +source "hyperv-iso" "vm" { + boot_command = ["${var.boot_command}"] + boot_wait = "5s" + communicator = "ssh" + cpus = "${var.cpus}" + disk_block_size = "1" + disk_size = "${var.disk_size}" + enable_dynamic_memory = "true" + enable_secure_boot = false + generation = 2 + guest_additions_mode = "disable" + http_directory = "./extra/files" + iso_checksum = "${var.iso_checksum_type}:${var.iso_checksum}" + iso_url = "${var.iso_url}" + memory = "${var.memory}" + output_directory = "${var.output_directory}" + shutdown_command = "echo 'password' | sudo -S shutdown -P now" + shutdown_timeout = "30m" + ssh_password = "${var.ssh_password}" + ssh_timeout = "4h" + ssh_username = "root" + switch_name = "${var.switch_name}" + temp_path = "." + vlan_id = "${var.vlan_id}" + vm_name = "${var.vm_name}" +} + +build { + sources = ["source.hyperv-iso.vm"] + + provisioner "file" { + destination = "/tmp/ansible.sh" + source = "extra/files/gen2-linux/ansible.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i true"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/variables.yml" + source = "extra/playbooks/provision_alma9_variables.yml" + } + + provisioner "file" { + destination = "/tmp/override.yml" + source = "${var.ansible_override}" + } + + provisioner "file" { + destination = "/tmp/prepare_neofetch.sh" + source = "extra/files/gen2-linux/prepare_neofetch.sh" + } + + provisioner "ansible-local" { + extra_arguments = ["-e", "@/tmp/variables.yml", "-e", "@/tmp/override.yml"] + playbook_file = "extra/playbooks/provision_centos.yaml" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i false"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/usr/local/bin/uefi.sh" + source = "extra/files/gen2-almalinux9/uefi.sh" + } + + provisioner "file" { + destination = "/tmp/scvmmguestagent.1.0.3.1028.x64.tar" + source = "extra/files/scagent/1.0.3.1028/scvmmguestagent.1.0.3.1028.x64.tar" + } + + provisioner "file" { + destination = "/tmp/install" + source = "extra/files/scagent/1.0.3.1028/install.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + expect_disconnect = true + inline = ["chmod +x /tmp/install", "sh /tmp/install \"$(ls /tmp/scvmm*.x64.tar)\"", "reboot"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/zeroing.sh" + source = "extra/files/gen2-linux/zeroing.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["echo Last Phase", "chmod +x /usr/local/bin/uefi.sh", "systemctl set-default multi-user.target", "/bin/rm -f /etc/ssh/*key*", "chmod +x /tmp/zeroing.sh", "/tmp/zeroing.sh", "/bin/rm -rfv /tmp/*"] + inline_shebang = "/bin/sh -x" + pause_before = "30s" + } + +} diff --git a/templates/hv_almalinux9_g2_docker.pkr.hcl b/templates/hv_almalinux9_g2_docker.pkr.hcl new file mode 100644 index 0000000..54c15c3 --- /dev/null +++ b/templates/hv_almalinux9_g2_docker.pkr.hcl @@ -0,0 +1,184 @@ + +variable "ansible_override" { + type = string + default = "" +} + +variable "boot_command" { + type = string + default = "" +} + +variable "disk_size" { + type = string + default = "70000" +} + +variable "disk_additional_size" { + type = list(number) + default = ["1024"] +} + +variable "memory" { + type = string + default = "1024" +} + +variable "cpus" { + type = string + default = "1" +} + +variable "iso_checksum" { + type = string + default = "" +} + +variable "iso_checksum_type" { + type = string + default = "" +} + +variable "iso_url" { + type = string + default = "" +} + +variable "output_directory" { + type = string + default = "" +} +variable "provision_script_options" { + type = string + default = "" +} +variable "output_vagrant" { + type = string + default = "" +} +variable "ssh_password" { + type = string + default = "" + sensitive = true +} + +variable "switch_name" { + type = string + default = "" +} +variable "vagrantfile_template" { + type = string + default = "" +} +variable "vlan_id" { + type = string + default = "" +} + +variable "vm_name" { + type = string + default = "" +} + +source "hyperv-iso" "vm" { + boot_command = ["${var.boot_command}"] + boot_wait = "5s" + communicator = "ssh" + cpus = "${var.cpus}" + disk_additional_size = "${var.disk_additional_size}" + disk_block_size = "1" + disk_size = "${var.disk_size}" + enable_dynamic_memory = "true" + enable_secure_boot = false + generation = 2 + guest_additions_mode = "disable" + http_directory = "./extra/files" + iso_checksum = "${var.iso_checksum_type}:${var.iso_checksum}" + iso_url = "${var.iso_url}" + memory = "${var.memory}" + output_directory = "${var.output_directory}-dck" + shutdown_command = "echo 'password' | sudo -S shutdown -P now" + shutdown_timeout = "30m" + ssh_password = "${var.ssh_password}" + ssh_timeout = "4h" + ssh_username = "root" + switch_name = "${var.switch_name}" + temp_path = "." + vlan_id = "${var.vlan_id}" + vm_name = "${var.vm_name}-dck" +} + +build { + sources = ["source.hyperv-iso.vm"] + + provisioner "file" { + destination = "/tmp/ansible.sh" + source = "extra/files/gen2-linux/ansible.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i true"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/variables.yml" + source = "extra/playbooks/provision_alma9_variables.yml" + } + + provisioner "file" { + destination = "/tmp/override.yml" + source = "${var.ansible_override}" + } + + provisioner "file" { + destination = "/tmp/prepare_neofetch.sh" + source = "extra/files/gen2-linux/prepare_neofetch.sh" + } + + provisioner "ansible-local" { + extra_arguments = ["-e", "@/tmp/variables.yml", "-e", "@/tmp/override.yml"] + playbook_file = "extra/playbooks/provision_centos.yaml" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i false"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/usr/local/bin/uefi.sh" + source = "extra/files/gen2-almalinux9/uefi.sh" + } + + provisioner "file" { + destination = "/tmp/scvmmguestagent.1.0.3.1028.x64.tar" + source = "extra/files/scagent/1.0.3.1028/scvmmguestagent.1.0.3.1028.x64.tar" + } + + provisioner "file" { + destination = "/tmp/install" + source = "extra/files/scagent/1.0.3.1028/install.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + expect_disconnect = true + inline = ["chmod +x /tmp/install", "sh /tmp/install \"$(ls /tmp/scvmm*.x64.tar)\"", "reboot"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/zeroing.sh" + source = "extra/files/gen2-linux/zeroing.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["echo Last Phase", "chmod +x /usr/local/bin/uefi.sh", "systemctl set-default multi-user.target", "/bin/rm -f /etc/ssh/*key*", "chmod +x /tmp/zeroing.sh", "/tmp/zeroing.sh", "/bin/rm -rfv /tmp/*"] + inline_shebang = "/bin/sh -x" + pause_before = "30s" + } +} diff --git a/templates/hv_almalinux9_g2_vagrant.pkr.hcl b/templates/hv_almalinux9_g2_vagrant.pkr.hcl new file mode 100644 index 0000000..677fe42 --- /dev/null +++ b/templates/hv_almalinux9_g2_vagrant.pkr.hcl @@ -0,0 +1,193 @@ + +variable "ansible_override" { + type = string + default = "" +} + +variable "boot_command" { + type = string + default = "" +} + +variable "disk_size" { + type = string + default = "70000" +} + +variable "disk_additional_size" { + type = list(number) + default = ["1024"] +} + +variable "memory" { + type = string + default = "1024" +} + +variable "cpus" { + type = string + default = "1" +} + +variable "iso_checksum" { + type = string + default = "" +} + +variable "iso_checksum_type" { + type = string + default = "" +} + +variable "iso_url" { + type = string + default = "" +} + +variable "output_directory" { + type = string + default = "" +} +variable "provision_script_options" { + type = string + default = "" +} +variable "output_vagrant" { + type = string + default = "" +} +variable "ssh_password" { + type = string + default = "" + sensitive = true +} + +variable "switch_name" { + type = string + default = "" +} +variable "vagrantfile_template" { + type = string + default = "" +} +variable "vlan_id" { + type = string + default = "" +} + +variable "vm_name" { + type = string + default = "" +} + +source "hyperv-iso" "vm" { + boot_command = ["${var.boot_command}"] + boot_wait = "5s" + communicator = "ssh" + cpus = "${var.cpus}" + disk_block_size = "1" + disk_size = "${var.disk_size}" + enable_dynamic_memory = "true" + enable_secure_boot = false + generation = 2 + guest_additions_mode = "disable" + http_directory = "./extra/files" + iso_checksum = "${var.iso_checksum_type}:${var.iso_checksum}" + iso_url = "${var.iso_url}" + memory = "${var.memory}" + output_directory = "${var.output_directory}-vgr" + shutdown_command = "echo 'password' | sudo -S shutdown -P now" + shutdown_timeout = "30m" + ssh_password = "${var.ssh_password}" + ssh_timeout = "4h" + ssh_username = "root" + switch_name = "${var.switch_name}" + temp_path = "." + vlan_id = "${var.vlan_id}" + vm_name = "${var.vm_name}-vgr" +} + +build { + sources = ["source.hyperv-iso.vm"] + + provisioner "file" { + destination = "/tmp/ansible.sh" + source = "extra/files/gen2-linux/ansible.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i true"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/variables.yml" + source = "extra/playbooks/provision_alma9_variables.yml" + } + + provisioner "file" { + destination = "/tmp/override.yml" + source = "${var.ansible_override}" + } + + provisioner "file" { + destination = "/tmp/prepare_neofetch.sh" + source = "extra/files/gen2-linux/prepare_neofetch.sh" + } + + provisioner "ansible-local" { + extra_arguments = ["-e", "@/tmp/variables.yml", "-e", "@/tmp/override.yml"] + playbook_file = "extra/playbooks/provision_centos.yaml" + } + + provisioner "ansible-local" { + playbook_file = "extra/playbooks/provision_vagrant.yaml" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i false"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/usr/local/bin/uefi.sh" + source = "extra/files/gen2-almalinux9/uefi.sh" + } + + provisioner "file" { + destination = "/tmp/scvmmguestagent.1.0.3.1028.x64.tar" + source = "extra/files/scagent/1.0.3.1028/scvmmguestagent.1.0.3.1028.x64.tar" + } + + provisioner "file" { + destination = "/tmp/install" + source = "extra/files/scagent/1.0.3.1028/install.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + expect_disconnect = true + inline = ["chmod +x /tmp/install", "sh /tmp/install \"$(ls /tmp/scvmm*.x64.tar)\"", "reboot"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/zeroing.sh" + source = "extra/files/gen2-linux/zeroing.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["echo Last Phase", "chmod +x /usr/local/bin/uefi.sh", "systemctl set-default multi-user.target", "/bin/rm -f /etc/ssh/*key*", "chmod +x /tmp/zeroing.sh", "/tmp/zeroing.sh", "/bin/rm -rfv /tmp/*"] + inline_shebang = "/bin/sh -x" + pause_before = "30s" + } + + post-processor "vagrant" { + keep_input_artifact = true + output = "${var.output_vagrant}" + vagrantfile_template = "${var.vagrantfile_template}" + } +} diff --git a/templates/hv_oraclelinux9_g2.pkr.hcl b/templates/hv_oraclelinux9_g2.pkr.hcl new file mode 100644 index 0000000..35e95e3 --- /dev/null +++ b/templates/hv_oraclelinux9_g2.pkr.hcl @@ -0,0 +1,186 @@ + +variable "ansible_override" { + type = string + default = "" +} + +variable "boot_command" { + type = string + default = "" +} + +variable "disk_size" { + type = string + default = "70000" +} + +variable "disk_additional_size" { + type = list(number) + default = ["1024"] +} + +variable "memory" { + type = string + default = "1024" +} + +variable "cpus" { + type = string + default = "1" +} + +variable "iso_checksum" { + type = string + default = "" +} + +variable "iso_checksum_type" { + type = string + default = "" +} + +variable "iso_url" { + type = string + default = "" +} + +variable "output_directory" { + type = string + default = "" +} +variable "provision_script_options" { + type = string + default = "" +} +variable "output_vagrant" { + type = string + default = "" +} +variable "ssh_password" { + type = string + default = "" + sensitive = true +} + +variable "switch_name" { + type = string + default = "" +} + +variable "vagrantfile_template" { + type = string + default = "" +} + +variable "vlan_id" { + type = string + default = "" +} + +variable "vm_name" { + type = string + default = "" +} + +source "hyperv-iso" "vm" { + boot_command = ["${var.boot_command}"] + boot_wait = "5s" + communicator = "ssh" + cpus = "${var.cpus}" + disk_block_size = "1" + disk_size = "${var.disk_size}" + enable_dynamic_memory = "true" + enable_secure_boot = false + generation = 2 + guest_additions_mode = "disable" + http_directory = "./extra/files" + iso_checksum = "${var.iso_checksum_type}:${var.iso_checksum}" + iso_url = "${var.iso_url}" + memory = "${var.memory}" + output_directory = "${var.output_directory}" + shutdown_command = "echo 'password' | sudo -S shutdown -P now" + shutdown_timeout = "30m" + ssh_password = "${var.ssh_password}" + ssh_timeout = "4h" + ssh_username = "root" + switch_name = "${var.switch_name}" + temp_path = "." + vlan_id = "${var.vlan_id}" + vm_name = "${var.vm_name}" +} + +build { + sources = ["source.hyperv-iso.vm"] + + provisioner "file" { + destination = "/tmp/ansible.sh" + source = "extra/files/gen2-linux/ansible.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i true"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/variables.yml" + source = "extra/playbooks/provision_oracle9_variables.yml" + } + + provisioner "file" { + destination = "/tmp/override.yml" + source = "${var.ansible_override}" + } + + provisioner "file" { + destination = "/tmp/prepare_neofetch.sh" + source = "extra/files/gen2-linux/prepare_neofetch.sh" + } + + provisioner "ansible-local" { + extra_arguments = ["-e", "@/tmp/variables.yml", "-e", "@/tmp/override.yml"] + playbook_file = "extra/playbooks/provision_centos.yaml" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i false"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/usr/local/bin/uefi.sh" + source = "extra/files/gen2-oraclelinux9/uefi.sh" + } + + provisioner "file" { + destination = "/tmp/scvmmguestagent.1.0.3.1028.x64.tar" + source = "extra/files/scagent/1.0.3.1028/scvmmguestagent.1.0.3.1028.x64.tar" + } + + provisioner "file" { + destination = "/tmp/install" + source = "extra/files/scagent/1.0.3.1028/install.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + expect_disconnect = true + inline = ["chmod +x /tmp/install", "sh /tmp/install \"$(ls /tmp/scvmm*.x64.tar)\"", "reboot"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/zeroing.sh" + source = "extra/files/gen2-linux/zeroing.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["echo Last Phase", "chmod +x /usr/local/bin/uefi.sh", "systemctl set-default multi-user.target", "/bin/rm -f /etc/ssh/*key*", "chmod +x /tmp/zeroing.sh", "/tmp/zeroing.sh", "/bin/rm -rfv /tmp/*"] + inline_shebang = "/bin/sh -x" + pause_before = "30s" + } + +} diff --git a/templates/hv_oraclelinux9_g2_docker.pkr.hcl b/templates/hv_oraclelinux9_g2_docker.pkr.hcl new file mode 100644 index 0000000..8941f34 --- /dev/null +++ b/templates/hv_oraclelinux9_g2_docker.pkr.hcl @@ -0,0 +1,187 @@ + +variable "ansible_override" { + type = string + default = "" +} + +variable "boot_command" { + type = string + default = "" +} + +variable "disk_size" { + type = string + default = "70000" +} + +variable "disk_additional_size" { + type = list(number) + default = ["1024"] +} + +variable "memory" { + type = string + default = "1024" +} + +variable "cpus" { + type = string + default = "1" +} + +variable "iso_checksum" { + type = string + default = "" +} + +variable "iso_checksum_type" { + type = string + default = "" +} + +variable "iso_url" { + type = string + default = "" +} + +variable "output_directory" { + type = string + default = "" +} +variable "provision_script_options" { + type = string + default = "" +} +variable "output_vagrant" { + type = string + default = "" +} +variable "ssh_password" { + type = string + default = "" + sensitive = true +} + +variable "switch_name" { + type = string + default = "" +} + +variable "vagrantfile_template" { + type = string + default = "" +} + +variable "vlan_id" { + type = string + default = "" +} + +variable "vm_name" { + type = string + default = "" +} + +source "hyperv-iso" "vm" { + boot_command = ["${var.boot_command}"] + boot_wait = "5s" + communicator = "ssh" + cpus = "${var.cpus}" + disk_additional_size = "${var.disk_additional_size}" + disk_block_size = "1" + disk_size = "${var.disk_size}" + enable_dynamic_memory = "true" + enable_secure_boot = false + generation = 2 + guest_additions_mode = "disable" + http_directory = "./extra/files" + iso_checksum = "${var.iso_checksum_type}:${var.iso_checksum}" + iso_url = "${var.iso_url}" + memory = "${var.memory}" + output_directory = "${var.output_directory}-dck" + shutdown_command = "echo 'password' | sudo -S shutdown -P now" + shutdown_timeout = "30m" + ssh_password = "${var.ssh_password}" + ssh_timeout = "4h" + ssh_username = "root" + switch_name = "${var.switch_name}" + temp_path = "." + vlan_id = "${var.vlan_id}" + vm_name = "${var.vm_name}-dck" +} + +build { + sources = ["source.hyperv-iso.vm"] + + provisioner "file" { + destination = "/tmp/ansible.sh" + source = "extra/files/gen2-linux/ansible.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i true"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/variables.yml" + source = "extra/playbooks/provision_oracle9_variables.yml" + } + + provisioner "file" { + destination = "/tmp/override.yml" + source = "${var.ansible_override}" + } + + provisioner "file" { + destination = "/tmp/prepare_neofetch.sh" + source = "extra/files/gen2-linux/prepare_neofetch.sh" + } + + provisioner "ansible-local" { + extra_arguments = ["-e", "@/tmp/variables.yml", "-e", "@/tmp/override.yml"] + playbook_file = "extra/playbooks/provision_centos.yaml" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i false"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/usr/local/bin/uefi.sh" + source = "extra/files/gen2-oraclelinux9/uefi.sh" + } + + provisioner "file" { + destination = "/tmp/scvmmguestagent.1.0.3.1028.x64.tar" + source = "extra/files/scagent/1.0.3.1028/scvmmguestagent.1.0.3.1028.x64.tar" + } + + provisioner "file" { + destination = "/tmp/install" + source = "extra/files/scagent/1.0.3.1028/install.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + expect_disconnect = true + inline = ["chmod +x /tmp/install", "sh /tmp/install \"$(ls /tmp/scvmm*.x64.tar)\"", "reboot"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/zeroing.sh" + source = "extra/files/gen2-linux/zeroing.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["echo Last Phase", "chmod +x /usr/local/bin/uefi.sh", "systemctl set-default multi-user.target", "/bin/rm -f /etc/ssh/*key*", "chmod +x /tmp/zeroing.sh", "/tmp/zeroing.sh", "/bin/rm -rfv /tmp/*"] + inline_shebang = "/bin/sh -x" + pause_before = "30s" + } + +} diff --git a/templates/hv_oraclelinux9_g2_vagrant.pkr.hcl b/templates/hv_oraclelinux9_g2_vagrant.pkr.hcl new file mode 100644 index 0000000..727dff7 --- /dev/null +++ b/templates/hv_oraclelinux9_g2_vagrant.pkr.hcl @@ -0,0 +1,195 @@ + +variable "ansible_override" { + type = string + default = "" +} + +variable "boot_command" { + type = string + default = "" +} + +variable "disk_size" { + type = string + default = "70000" +} + +variable "disk_additional_size" { + type = list(number) + default = ["1024"] +} + +variable "memory" { + type = string + default = "1024" +} + +variable "cpus" { + type = string + default = "1" +} + +variable "iso_checksum" { + type = string + default = "" +} + +variable "iso_checksum_type" { + type = string + default = "" +} + +variable "iso_url" { + type = string + default = "" +} + +variable "output_directory" { + type = string + default = "" +} +variable "provision_script_options" { + type = string + default = "" +} +variable "output_vagrant" { + type = string + default = "" +} +variable "ssh_password" { + type = string + default = "" + sensitive = true +} + +variable "switch_name" { + type = string + default = "" +} + +variable "vagrantfile_template" { + type = string + default = "" +} + +variable "vlan_id" { + type = string + default = "" +} + +variable "vm_name" { + type = string + default = "" +} + +source "hyperv-iso" "vm" { + boot_command = ["${var.boot_command}"] + boot_wait = "5s" + communicator = "ssh" + cpus = "${var.cpus}" + disk_block_size = "1" + disk_size = "${var.disk_size}" + enable_dynamic_memory = "true" + enable_secure_boot = false + generation = 2 + guest_additions_mode = "disable" + http_directory = "./extra/files" + iso_checksum = "${var.iso_checksum_type}:${var.iso_checksum}" + iso_url = "${var.iso_url}" + memory = "${var.memory}" + output_directory = "${var.output_directory}-vgr" + shutdown_command = "echo 'password' | sudo -S shutdown -P now" + shutdown_timeout = "30m" + ssh_password = "${var.ssh_password}" + ssh_timeout = "4h" + ssh_username = "root" + switch_name = "${var.switch_name}" + temp_path = "." + vlan_id = "${var.vlan_id}" + vm_name = "${var.vm_name}-vgr" +} + +build { + sources = ["source.hyperv-iso.vm"] + + provisioner "file" { + destination = "/tmp/ansible.sh" + source = "extra/files/gen2-linux/ansible.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i true"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/variables.yml" + source = "extra/playbooks/provision_oracle9_variables.yml" + } + + provisioner "file" { + destination = "/tmp/override.yml" + source = "${var.ansible_override}" + } + + provisioner "file" { + destination = "/tmp/prepare_neofetch.sh" + source = "extra/files/gen2-linux/prepare_neofetch.sh" + } + + provisioner "ansible-local" { + extra_arguments = ["-e", "@/tmp/variables.yml", "-e", "@/tmp/override.yml"] + playbook_file = "extra/playbooks/provision_centos.yaml" + } + + provisioner "ansible-local" { + playbook_file = "extra/playbooks/provision_vagrant.yaml" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["chmod +x /tmp/ansible.sh", "/tmp/ansible.sh -i false"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/usr/local/bin/uefi.sh" + source = "extra/files/gen2-oraclelinux9/uefi.sh" + } + + provisioner "file" { + destination = "/tmp/scvmmguestagent.1.0.3.1028.x64.tar" + source = "extra/files/scagent/1.0.3.1028/scvmmguestagent.1.0.3.1028.x64.tar" + } + + provisioner "file" { + destination = "/tmp/install" + source = "extra/files/scagent/1.0.3.1028/install.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + expect_disconnect = true + inline = ["chmod +x /tmp/install", "sh /tmp/install \"$(ls /tmp/scvmm*.x64.tar)\"", "reboot"] + inline_shebang = "/bin/sh -x" + } + + provisioner "file" { + destination = "/tmp/zeroing.sh" + source = "extra/files/gen2-linux/zeroing.sh" + } + + provisioner "shell" { + execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'" + inline = ["echo Last Phase", "chmod +x /usr/local/bin/uefi.sh", "systemctl set-default multi-user.target", "/bin/rm -f /etc/ssh/*key*", "chmod +x /tmp/zeroing.sh", "/tmp/zeroing.sh", "/bin/rm -rfv /tmp/*"] + inline_shebang = "/bin/sh -x" + pause_before = "30s" + } + + post-processor "vagrant" { + keep_input_artifact = true + output = "${var.output_vagrant}" + vagrantfile_template = "${var.vagrantfile_template}" + } +} diff --git a/vagrant/hv_rockylinux91_g2.template b/vagrant/hv_almalinux92_g2.template similarity index 89% rename from vagrant/hv_rockylinux91_g2.template rename to vagrant/hv_almalinux92_g2.template index 7f79069..6e21b5c 100644 --- a/vagrant/hv_rockylinux91_g2.template +++ b/vagrant/hv_almalinux92_g2.template @@ -4,8 +4,8 @@ Vagrant.require_version ">= 1.6.2" Vagrant.configure("2") do |config| - config.vm.define "vagrant-rockylinux91" - config.vm.box = "rockylinux91" + config.vm.define "vagrant-almalinux86" + config.vm.box = "almalinux92" config.vm.communicator = "ssh" config.vm.synced_folder ".", "/vagrant", type: "rsync", disabled: "true" diff --git a/vagrant/hv_oraclelinux92_g2.template b/vagrant/hv_oraclelinux92_g2.template new file mode 100644 index 0000000..b2d2c53 --- /dev/null +++ b/vagrant/hv_oraclelinux92_g2.template @@ -0,0 +1,27 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.require_version ">= 1.6.2" + +Vagrant.configure("2") do |config| + config.vm.define "vagrant-oraclelinux92" + config.vm.box = "oraclelinux92" + config.vm.communicator = "ssh" + config.vm.synced_folder ".", "/vagrant", type: "rsync", disabled: "true" + + # Admin user name and password + config.ssh.username = "vagrant" + config.ssh.password = "vagrant" + config.vm.guest = :redhat + +# config.vm.provider "hyperv" do |h| +# h.vm_integration_services = { +# guest_service_interface: true, +# heartbeat: true, +# key_value_pair_exchange: true, +# shutdown: true, +# time_synchronization: true, +# vss: boolean +# } +# end + end diff --git a/vagrant/hv_rockylinux92_g2.template b/vagrant/hv_rockylinux92_g2.template new file mode 100644 index 0000000..14fa742 --- /dev/null +++ b/vagrant/hv_rockylinux92_g2.template @@ -0,0 +1,27 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.require_version ">= 1.6.2" + +Vagrant.configure("2") do |config| + config.vm.define "vagrant-rockylinux92" + config.vm.box = "rockylinux92" + config.vm.communicator = "ssh" + config.vm.synced_folder ".", "/vagrant", type: "rsync", disabled: "true" + + # Admin user name and password + config.ssh.username = "vagrant" + config.ssh.password = "vagrant" + config.vm.guest = :redhat + +# config.vm.provider "hyperv" do |h| +# h.vm_integration_services = { +# guest_service_interface: true, +# heartbeat: true, +# key_value_pair_exchange: true, +# shutdown: true, +# time_synchronization: true, +# vss: boolean +# } +# end + end diff --git a/variables/almalinux9.yml b/variables/almalinux9.yml new file mode 100644 index 0000000..21e7d29 --- /dev/null +++ b/variables/almalinux9.yml @@ -0,0 +1,17 @@ +install_epel: true +install_webmin: false +install_hyperv: true +install_zabbix: false +install_zabbix_as_root: false +install_cockpit: true +install_puppet: false +install_docker_workaround: false +install_kubernetes_workaround: false +remove_puppet_ssl_keys: false +install_neofetch: true +install_updates: true +install_extra_groups: true +docker_prepare: false +extra_device: "" +install_motd: true + diff --git a/variables/almalinux9_docker.yml b/variables/almalinux9_docker.yml new file mode 100644 index 0000000..74ed3ab --- /dev/null +++ b/variables/almalinux9_docker.yml @@ -0,0 +1,16 @@ +install_epel: true +install_webmin: false +install_hyperv: true +install_zabbix: false +install_zabbix_as_root: false +install_cockpit: true +install_puppet: false +install_docker_workaround: true +install_kubernetes_workaround: false +remove_puppet_ssl_keys: false +install_neofetch: true +install_updates: true +install_extra_groups: true +docker_prepare: true +extra_device: "sdb" +install_motd: true diff --git a/variables/oraclelinux9.yml b/variables/oraclelinux9.yml new file mode 100644 index 0000000..f4b6bdf --- /dev/null +++ b/variables/oraclelinux9.yml @@ -0,0 +1,17 @@ +install_epel: true +install_webmin: false +install_hyperv: true +install_zabbix: false +install_zabbix_as_root: false +install_cockpit: true +install_puppet: false +install_docker_workaround: true +install_kubernetes_workaround: false +remove_puppet_ssl_keys: false +install_neofetch: true +install_updates: true +install_extra_groups: true +docker_prepare: false +extra_device: "" +install_motd: true + diff --git a/variables/oraclelinux9_docker.yml b/variables/oraclelinux9_docker.yml new file mode 100644 index 0000000..bebdc88 --- /dev/null +++ b/variables/oraclelinux9_docker.yml @@ -0,0 +1,17 @@ +install_epel: true +install_webmin: false +install_hyperv: true +install_zabbix: false +install_zabbix_as_root: false +install_cockpit: true +install_puppet: false +install_docker_workaround: true +install_kubernetes_workaround: false +remove_puppet_ssl_keys: false +install_neofetch: true +install_updates: true +install_extra_groups: true +docker_prepare: true +extra_device: "sdb" +install_motd: true + diff --git a/variables/variables_almalinux92.pkvars.hcl b/variables/variables_almalinux92.pkvars.hcl new file mode 100644 index 0000000..70fc9ce --- /dev/null +++ b/variables/variables_almalinux92.pkvars.hcl @@ -0,0 +1,17 @@ +iso_url = "https://almalinux.slaskdatacenter.com/9.2/isos/x86_64/AlmaLinux-9.2-x86_64-dvd.iso" +iso_checksum_type = "sha256" +iso_checksum = "00c91b923997c44822595998deb0cebcfaa53e93c2bed8745b04516badff431f" +vm_name = "packer-almalinux92-g2" +disk_size = "70000" +disk_additional_size = ["150000"] +switch_name = "vSwitch" +output_directory = "output-almalinux92" +output_vagrant = "./vbox/packer-almalinux92-g2.box" +vlan_id = "" +memory = "4096" +cpus = "4" +vagrantfile_template = "./vagrant/hv_almalinux92_g2.template" +ssh_password = "password" +provision_script_options = "-z false" +boot_command = "c setparams 'kickstart' linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=AlmaLinux-9-2-x86_64-dvd inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/gen2-almalinux9/ks.cfg initrdefi /images/pxeboot/initrd.img boot" +ansible_override = "variables/almalinux9.yml" diff --git a/variables/variables_oraclelinux92.pkvars.hcl b/variables/variables_oraclelinux92.pkvars.hcl new file mode 100644 index 0000000..0a8e983 --- /dev/null +++ b/variables/variables_oraclelinux92.pkvars.hcl @@ -0,0 +1,17 @@ +iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL9/u2/x86_64/OracleLinux-R9-U2-x86_64-dvd.iso" +iso_checksum_type = "sha256" +iso_checksum = "cac3c41cc2d3467ba8902a5d74575bcf460f129634d5a0d1d67d87094dd70b09" +vm_name = "packer-oraclelinux92-g2" +disk_size = "70000" +disk_additional_size = ["150000"] +switch_name = "vSwitch" +output_directory = "output-oraclelinux92" +output_vagrant = "./vbox/packer-oraclelinux92-g2.box" +vlan_id = "" +memory = "4096" +cpus = "4" +vagrantfile_template = "./vagrant/hv_oraclelinux92_g2.template" +ssh_password = "password" +provision_script_options = "-z false" +boot_command = "c setparams 'kickstart' linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=OL-9-2-0-BaseOS-x86_64 inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/gen2-oraclelinux9/ks.cfg initrdefi /images/pxeboot/initrd.img boot" +ansible_override = "variables/oraclelinux9.yml" diff --git a/variables/variables_rockylinux91.pkvars.hcl b/variables/variables_rockylinux92.pkvars.hcl similarity index 58% rename from variables/variables_rockylinux91.pkvars.hcl rename to variables/variables_rockylinux92.pkvars.hcl index 342ef79..f48e53b 100644 --- a/variables/variables_rockylinux91.pkvars.hcl +++ b/variables/variables_rockylinux92.pkvars.hcl @@ -1,17 +1,17 @@ -iso_url = "https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.1-x86_64-dvd.iso" +iso_url = "https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.2-x86_64-dvd.iso" iso_checksum_type = "sha256" -iso_checksum = "69fa71d69a07c9d204da81767719a2af183d113bc87ee5f533f98a194a5a1f8a" -vm_name = "packer-rockylinux91-g2" +iso_checksum = "cd43bb2671472471b1fc0a7a30113dfc9a56831516c46f4dbd12fb43bb4286d2" +vm_name = "packer-rockylinux92-g2" disk_size = "70000" disk_additional_size = ["150000"] switch_name = "vSwitch" -output_directory = "output-rockylinux91" -output_vagrant = "./vbox/packer-rockylinux91-g2.box" +output_directory = "output-rockylinux92" +output_vagrant = "./vbox/packer-rockylinux92-g2.box" vlan_id = "" memory = "4096" cpus = "4" -vagrantfile_template = "./vagrant/hv_rockylinux91_g2.template" +vagrantfile_template = "./vagrant/hv_rockylinux92_g2.template" ssh_password = "password" provision_script_options = "-z false" -boot_command = "c setparams 'kickstart' linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Rocky-9-1-x86_64-dvd inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/gen2-rockylinux9/ks.cfg initrdefi /images/pxeboot/initrd.img boot" +boot_command = "c setparams 'kickstart' linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Rocky-9-2-x86_64-dvd inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/gen2-rockylinux9/ks.cfg initrdefi /images/pxeboot/initrd.img boot" ansible_override = "variables/rockylinux9.yml"