diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27afbf2..31fdbf3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,8 +2,6 @@ name: Test the components of it "on": push: - branches: - - main paths-ignore: - .github/workflow/build.yml - http/** diff --git a/.gitignore b/.gitignore index 84b7478..8552264 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ isolinux.cfg # Generated distros distros/fedora-rawhide-*.hcl +distros/centos-8stream-*.hcl +distros/centos-9stream-*.hcl +cellar/centos-9stream-*.hcl diff --git a/.gitmodules b/.gitmodules index 5e09482..ff938f2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,3 +14,11 @@ path = http/fedora/rawhide url = https://pagure.io/fedora-kickstarts.git branch = main +[submodule "http/centos-upstream"] + path = http/centos-upstream + url = https://git.centos.org/centos/kickstarts.git + branch = master +[submodule "http/centos-stream"] + path = http/centos-stream + url = https://github.com/greg-hellings/centos-stream-kickstarts-mirror.git + branch = main diff --git a/ansible/playbook.yml b/ansible/playbook.yml index a3491fd..da3cc3f 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -7,23 +7,29 @@ name: "*" state: latest when: ansible_facts.pkg_mgr not in ['atomic_container'] + register: _update_all + retries: 3 + until: _update_all is success - name: Update atomic things become: true ansible.builtin.command: rpm-ostree upgrade when: ansible_facts.pkg_mgr in ['atomic_container'] changed_when: false + register: _update_atomic + retries: 3 + until: _update_atomic is success - name: Restart the machine become: true ansible.builtin.reboot: roles: + - role: devroles.system.epel - role: virtualbox when: packer_builder_type == 'virtualbox-iso' - role: vmware when: packer_builder_type == 'vmware-iso' - role: init - - role: devroles.system.epel - role: locale - role: vagrant - role: cleanup diff --git a/ansible/roles/cleanup/molecule/centos7/molecule.yml b/ansible/roles/cleanup/molecule/centos7/molecule.yml new file mode 100644 index 0000000..b03316b --- /dev/null +++ b/ansible/roles/cleanup/molecule/centos7/molecule.yml @@ -0,0 +1,5 @@ +driver: + name: containers +platforms: + - name: test-centos7-locale + image: centos:7 diff --git a/ansible/roles/cleanup/molecule/centos8stream/molecule.yml b/ansible/roles/cleanup/molecule/centos8stream/molecule.yml new file mode 100644 index 0000000..7ac6384 --- /dev/null +++ b/ansible/roles/cleanup/molecule/centos8stream/molecule.yml @@ -0,0 +1,5 @@ +driver: + name: containers +platforms: + - name: test-centos8-locale + image: quay.io/centos/centos:stream8 diff --git a/ansible/roles/cleanup/molecule/shared/playbook.yml b/ansible/roles/cleanup/molecule/shared/playbook.yml new file mode 100644 index 0000000..98b1e85 --- /dev/null +++ b/ansible/roles/cleanup/molecule/shared/playbook.yml @@ -0,0 +1,9 @@ +- hosts: all + pre_tasks: + - name: Install necessary packge + become: true + package: + name: glibc-common + state: present + roles: + - locale diff --git a/ansible/roles/cleanup/tasks/CentOS.yml b/ansible/roles/cleanup/tasks/CentOS.yml index a10106e..a8cbc02 100644 --- a/ansible/roles/cleanup/tasks/CentOS.yml +++ b/ansible/roles/cleanup/tasks/CentOS.yml @@ -2,7 +2,7 @@ become: true ansible.builtin.shell: |- set -e - yum --enablerepo=epel clean all + yum clean all yum history new truncate -c -s 0 /var/log/yum.log changed_when: false diff --git a/ansible/roles/cleanup/tasks/CentOS_6.yml b/ansible/roles/cleanup/tasks/CentOS_6.yml deleted file mode 100644 index 5aa06a3..0000000 --- a/ansible/roles/cleanup/tasks/CentOS_6.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: remove unnecessesary packages - become: true - ansible.builtin.package: - name: - - perl - - gcc - - kernel-devel - state: absent diff --git a/ansible/roles/cleanup/tasks/CentOS_7.yml b/ansible/roles/cleanup/tasks/CentOS_7.yml index 4da16ef..3146a5c 100644 --- a/ansible/roles/cleanup/tasks/CentOS_7.yml +++ b/ansible/roles/cleanup/tasks/CentOS_7.yml @@ -6,6 +6,7 @@ - perl - gcc - kernel-devel - - net-tools + - kernel-headers - bzip2 + - epel-release state: absent diff --git a/ansible/roles/locale/molecule/centos7/molecule.yml b/ansible/roles/locale/molecule/centos7/molecule.yml new file mode 100644 index 0000000..b03316b --- /dev/null +++ b/ansible/roles/locale/molecule/centos7/molecule.yml @@ -0,0 +1,5 @@ +driver: + name: containers +platforms: + - name: test-centos7-locale + image: centos:7 diff --git a/ansible/roles/locale/molecule/centos8stream/molecule.yml b/ansible/roles/locale/molecule/centos8stream/molecule.yml new file mode 100644 index 0000000..7ac6384 --- /dev/null +++ b/ansible/roles/locale/molecule/centos8stream/molecule.yml @@ -0,0 +1,5 @@ +driver: + name: containers +platforms: + - name: test-centos8-locale + image: quay.io/centos/centos:stream8 diff --git a/ansible/roles/locale/molecule/centos9stream/molecule.yml b/ansible/roles/locale/molecule/centos9stream/molecule.yml new file mode 100644 index 0000000..aa8289c --- /dev/null +++ b/ansible/roles/locale/molecule/centos9stream/molecule.yml @@ -0,0 +1,5 @@ +driver: + name: containers +platforms: + - name: test-centos9-locale + image: quay.io/centos/centos:stream9 diff --git a/ansible/roles/locale/molecule/shared/playbook.yml b/ansible/roles/locale/molecule/shared/playbook.yml new file mode 100644 index 0000000..98b1e85 --- /dev/null +++ b/ansible/roles/locale/molecule/shared/playbook.yml @@ -0,0 +1,9 @@ +- hosts: all + pre_tasks: + - name: Install necessary packge + become: true + package: + name: glibc-common + state: present + roles: + - locale diff --git a/ansible/roles/locale/tasks/main.yml b/ansible/roles/locale/tasks/main.yml index 6191e0e..181deed 100644 --- a/ansible/roles/locale/tasks/main.yml +++ b/ansible/roles/locale/tasks/main.yml @@ -1,9 +1,11 @@ - name: update locale info become: true ansible.builtin.shell: | - set -eo pipefail - localedef --list-archive | grep -a -v en_US.utf8 | xargs sudo localedef --delete-from-archive + set -exo pipefail + localedef --list-archive | ( grep -a -v en_US.utf8 || printf '' ) | xargs -r sudo localedef --delete-from-archive cp /usr/lib/locale/locale-archive{,.tmpl} build-locale-archive when: > - ansible_facts['distribution'] in ['CentOS'] + ( ansible_facts['distribution'] in ['CentOS'] ) and + ( ansible_facts['distribution_major_version'] is version('8', '<') ) + changed_when: false diff --git a/ansible/roles/virtualbox/vars/CentOS.yml b/ansible/roles/virtualbox/vars/CentOS.yml index 22b19d1..55a796d 100644 --- a/ansible/roles/virtualbox/vars/CentOS.yml +++ b/ansible/roles/virtualbox/vars/CentOS.yml @@ -2,8 +2,10 @@ virtualbox_packages: - bzip2 - dkms - kernel-devel + - kernel-headers - make - perl + - gcc virtualbox_services: - dkms virtualbox_from_iso: true diff --git a/ansible/roles/virtualbox/vars/Debian.yml b/ansible/roles/virtualbox/vars/Debian.yml index 21b1efa..cc82b9b 100644 --- a/ansible/roles/virtualbox/vars/Debian.yml +++ b/ansible/roles/virtualbox/vars/Debian.yml @@ -2,4 +2,3 @@ virtualbox_packages: - linux-image-amd64 virtualbox_services: [] virtualbox_from_iso: false -virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso" diff --git a/ansible/roles/virtualbox/vars/Debian_10.yml b/ansible/roles/virtualbox/vars/Debian_10.yml index 96ef151..fdcf9e1 100644 --- a/ansible/roles/virtualbox/vars/Debian_10.yml +++ b/ansible/roles/virtualbox/vars/Debian_10.yml @@ -5,4 +5,3 @@ virtualbox_packages: - make virtualbox_services: [] virtualbox_from_iso: true -virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso" diff --git a/ansible/roles/virtualbox/vars/Debian_9.yml b/ansible/roles/virtualbox/vars/Debian_9.yml index 96ef151..fdcf9e1 100644 --- a/ansible/roles/virtualbox/vars/Debian_9.yml +++ b/ansible/roles/virtualbox/vars/Debian_9.yml @@ -5,4 +5,3 @@ virtualbox_packages: - make virtualbox_services: [] virtualbox_from_iso: true -virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso" diff --git a/ansible/roles/virtualbox/vars/Fedora.yml b/ansible/roles/virtualbox/vars/Fedora.yml index 3b597df..b2033ae 100644 --- a/ansible/roles/virtualbox/vars/Fedora.yml +++ b/ansible/roles/virtualbox/vars/Fedora.yml @@ -11,6 +11,5 @@ virtualbox_packages: - dkms virtualbox_services: - dkms -virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso" virtualbox_from_iso: true virtualbox_pre_commands: [] diff --git a/ansible/roles/virtualbox/vars/main.yml b/ansible/roles/virtualbox/vars/main.yml new file mode 100644 index 0000000..2ad8786 --- /dev/null +++ b/ansible/roles/virtualbox/vars/main.yml @@ -0,0 +1 @@ +virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso" diff --git a/cellar/centos-9stream-x86_64.pkrvars.hcl.sh b/cellar/centos-9stream-x86_64.pkrvars.hcl.sh new file mode 100755 index 0000000..48fe1c4 --- /dev/null +++ b/cellar/centos-9stream-x86_64.pkrvars.hcl.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Name of the file to write out +name="${0%.sh}" + +checksums="$(mktemp)" +until curl -f -L -o "${checksums}" "http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso.SHA256SUM"; do + sleep 1 +done +sha="$(cat "${checksums}" | grep SHA256 | cut -d' ' -f 4)" + +cat << EOF > "${name}" +distro = "centos" +version = "9stream" +iso = { + url = "http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso" + checksum = "${sha}" +} +boot_command = [ + "", + "linux net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/centos/9stream-x86_64.ks console=ttyS0", + "" +] +EOF diff --git a/distros/centos-7-x86_64.pkrvars.hcl b/distros/centos-7-x86_64.pkrvars.hcl new file mode 100644 index 0000000..707f3d5 --- /dev/null +++ b/distros/centos-7-x86_64.pkrvars.hcl @@ -0,0 +1,11 @@ +distro = "centos" +version = "7" +iso = { + url = "http://mirror.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-2009.iso" + checksum = "b79079ad71cc3c5ceb3561fff348a1b67ee37f71f4cddfec09480d4589c191d6" +} +boot_command = [ + "", + "linux net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/centos/7-x86_64.ks console=ttyS0", + "" +] diff --git a/distros/centos-8stream-x86_64.pkrvars.hcl.sh b/distros/centos-8stream-x86_64.pkrvars.hcl.sh new file mode 100755 index 0000000..76ec4dc --- /dev/null +++ b/distros/centos-8stream-x86_64.pkrvars.hcl.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Name of the file to write out +name="${0%.sh}" + +checksums="$(mktemp)" +until curl -f -L -o "${checksums}" "http://mirror.centos.org/centos/8-stream/isos/x86_64/CHECKSUM"; do + sleep 1 +done +sha="$(cat "${checksums}" | grep latest-boot | grep SHA256 | cut -d' ' -f 4)" + +cat << EOF > "${name}" +distro = "centos" +version = "8stream" +iso = { + url = "http://mirror.centos.org/centos/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-boot.iso" + checksum = "${sha}" +} +boot_command = [ + "", + "linux net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/centos/8stream/x86_64.ks console=ttyS0", + "" +] +EOF diff --git a/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh b/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh index fb8bee7..ad36187 100755 --- a/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh +++ b/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh @@ -34,8 +34,8 @@ iso = { checksum = "${sha}" } boot_command = [ - "", - "edd=off net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/rawhide-x86_64.ks console=ttyS0 " + "e", + "edd=off net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/rawhide-x86_64.ks console=ttyS0" ] EOF diff --git a/http/centos-stream b/http/centos-stream new file mode 160000 index 0000000..9dd286b --- /dev/null +++ b/http/centos-stream @@ -0,0 +1 @@ +Subproject commit 9dd286be86e7d5d031b35c31a2057b5f6c5a5984 diff --git a/http/centos-upstream b/http/centos-upstream new file mode 160000 index 0000000..f3ff06d --- /dev/null +++ b/http/centos-upstream @@ -0,0 +1 @@ +Subproject commit f3ff06dd3057c39cab61075fb053848b39ae2646 diff --git a/http/centos/7-x86_64.ks b/http/centos/7-x86_64.ks new file mode 100644 index 0000000..5d3c7cb --- /dev/null +++ b/http/centos/7-x86_64.ks @@ -0,0 +1,52 @@ +install +text +reboot +url --url=http://mirror.centos.org/centos/7/os/x86_64/ +repo --name=updates --baseurl=http://mirror.centos.org/centos/7/updates/x86_64/ +lang en_US.UTF-8 +keyboard us +timezone --utc Etc/UTC +rootpw --plaintext vagrant +user --name=vagrant --groups=vagrant --password=vagrant --plaintext +zerombr +clearpart --all --initlabel +autopart --type=plain +bootloader --timeout=1 + +%packages +@core +which +libselinux-python +# mandatory packages in the @core group +-btrfs-progs +-iprutils +-kexec-tools +-plymouth +# default packages in the @core group +-*-firmware +-dracut-config-rescue +-kernel-tools +-libsysfs +-microcode_ctl +-NetworkManager* +-postfix +-rdma +%end + +%post --erroronfail +yum -y update + +cat < /etc/sudoers.d/vagrant +Defaults:vagrant !requiretty +vagrant ALL=(ALL) NOPASSWD: ALL +EOF +chmod 440 /etc/sudoers.d/vagrant + +ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules +cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <