-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using a Vagrant libvirt based virtual machine and OpenShift Local.
- Loading branch information
1 parent
42b8655
commit 8612f88
Showing
14 changed files
with
407 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
VAGRANTFILE_API_VERSION = "2" | ||
# export VAGRANT_EXPERIMENTAL="1" | ||
# export VAGRANT_EXPERIMENTAL="disks" | ||
|
||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
config.vm.box = "centos/stream8" | ||
#config.vm.box_url = "https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-Vagrant-8-latest.x86_64.vagrant-libvirt.box" gives 404 | ||
config.vm.box_url = "file:///$VagrantProjectHome/../CentOS-Stream-Vagrant-8-latest.x86_64.vagrant-libvirt.box" | ||
|
||
|
||
# Forward traffic on the host to the development server on the guest | ||
config.vm.network "forwarded_port", guest: 5000, host: 5000 | ||
# Forward traffic on the host to Redis on the guest | ||
config.vm.network "forwarded_port", guest: 6379, host: 6379 | ||
# Forward traffic on the host to the SSE server on the guest | ||
config.vm.network "forwarded_port", guest: 8080, host: 8080 | ||
|
||
|
||
if Vagrant.has_plugin?("vagrant-hostmanager") | ||
config.hostmanager.enabled = true | ||
config.hostmanager.manage_host = true | ||
end | ||
|
||
# Vagrant can share the source directory using rsync, NFS, or SSHFS (with the vagrant-sshfs | ||
# plugin). By default it rsyncs the current working directory to /vagrant. | ||
# | ||
# If you would prefer to use NFS to share the directory uncomment this and configure NFS | ||
# config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_version: 4, nfs_udp: false | ||
config.vm.synced_folder "..", "/vagrant" | ||
# config.vm.synced_folder ".", "/vagrant", disabled: true | ||
# config.vm.synced_folder ".", "/srv/pagure", | ||
# ssh_opts_append: "-o IdentitiesOnly=yes", | ||
# type: "sshfs" | ||
|
||
# To cache update packages (which is helpful if frequently doing `vagrant destroy && vagrant up`) | ||
# you can create a local directory and share it to the guest's DNF cache. The directory needs to | ||
# exist, so create it before you uncomment the line below. | ||
#Dir.mkdir('.dnf-cache') unless File.exists?('.dnf-cache') | ||
#config.vm.synced_folder ".dnf-cache", "/var/cache/dnf", | ||
# type: "sshfs", | ||
# sshfs_opts_append: "-o nonempty" | ||
|
||
# Comment this line if you would like to disable the automatic update during provisioning | ||
config.vm.provision "shell", inline: "sudo dnf -y --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos" | ||
|
||
# !!!!!!! resize disk image !!!!!!!!! | ||
config.vm.provision "shell", inline: "sudo dnf install -y cloud-utils-growpart" | ||
config.vm.provision "shell", inline: "sudo growpart /dev/vda 1" | ||
config.vm.provision "shell", inline: "sudo xfs_growfs /dev/vda1" | ||
|
||
# bootstrap and run with ansible | ||
config.vm.provision "ansible" do |ansible| | ||
# ansible.verbose = "-vvv" | ||
ansible.verbose = true | ||
ansible.playbook = "../playbooks/oc-cluster-setup.yml" | ||
end | ||
config.vm.provision "ansible" do |ansible| | ||
# ansible.verbose = "-vvv" | ||
ansible.verbose = true | ||
ansible.playbook = "../playbooks/oc-cluster-run.yml" | ||
ansible.extra_vars = "../secrets/openshift-local-pull-secret.yml" | ||
end | ||
config.vm.provision "ansible" do |ansible| | ||
# ansible.verbose = "-vvv" | ||
ansible.verbose = true | ||
ansible.playbook = "../playbooks/oc-cluster-tests-setup.yml" | ||
ansible.extra_vars = {"src_dir": "/vagrant"} | ||
end | ||
|
||
# Create the box | ||
config.vm.define "packit-oc-cluster" do |oc| | ||
oc.vm.host_name = "packit-oc-cluster.example.com" | ||
|
||
oc.vm.provider :libvirt do |domain| | ||
# Season to taste | ||
domain.cpus = 6 | ||
domain.graphics_type = "spice" | ||
domain.memory = 14336 | ||
domain.video_type = "qxl" | ||
domain.machine_virtual_size = 100 | ||
|
||
# Uncomment the following line if you would like to enable libvirt's unsafe cache | ||
# mode. It is called unsafe for a reason, as it causes the virtual host to ignore all | ||
# fsync() calls from the guest. Only do this if you are comfortable with the possibility of | ||
# your development guest becoming corrupted (in which case you should only need to do a | ||
# vagrant destroy and vagrant up to get a new one). | ||
# | ||
# domain.volume_cache = "unsafe" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
summary: Packit deployment checks | ||
|
||
discover: | ||
how: fmf | ||
|
||
execute: | ||
how: tmt | ||
|
||
/deployment: | ||
summary: Run packit-service deployment test | ||
discover+: | ||
test: | ||
- deployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
- name: Start Openshift Local cluster | ||
hosts: all | ||
gather_facts: False | ||
vars: | ||
pull_secret: "!!!TAKEN FROM VAGRANT FILE!!!" | ||
dest_pull_secret_file: /tmp/openshift-local-pull-secret.txt | ||
tasks: | ||
- name: Show pull secret | ||
ansible.builtin.debug: | ||
msg: "{{ pull_secret }}" | ||
- name: Create secret file from pull request var | ||
ansible.builtin.copy: | ||
content: "{{ pull_secret }}" | ||
dest: "{{ dest_pull_secret_file }}" | ||
mode: "0640" | ||
- name: Start cluster | ||
ansible.builtin.command: crc start -p {{ dest_pull_secret_file }} | ||
changed_when: False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
- name: Install an Openshift Local cluster | ||
hosts: all | ||
vars: | ||
crc_download_link: https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz | ||
tasks: | ||
- name: Add vagrant user to sudoers | ||
become: True | ||
ansible.builtin.lineinfile: | ||
path: /etc/sudoers | ||
state: present | ||
line: "vagrant ALL=(ALL) NOPASSWD: ALL" | ||
validate: /usr/sbin/visudo -cf %s | ||
- name: Download CRC | ||
ansible.builtin.get_url: | ||
url: "{{ crc_download_link }}" | ||
dest: /tmp | ||
mode: "0664" | ||
register: download | ||
- name: Unarchive tarball | ||
ansible.builtin.unarchive: | ||
src: "{{ download.dest }}" | ||
dest: /tmp | ||
list_files: True | ||
remote_src: True | ||
register: unarchive | ||
- name: Show crc executable path | ||
ansible.builtin.debug: | ||
msg: "/tmp/{{ unarchive.files[0] }}crc" | ||
- name: Create ~/.local/bin if it does not exist | ||
ansible.builtin.file: | ||
path: ~/.local/bin | ||
state: directory | ||
mode: "0755" | ||
- name: Create symbolic link to crc | ||
ansible.builtin.file: | ||
src: "/tmp/{{ unarchive.files[0] }}/crc" | ||
dest: ~/.local/bin/crc | ||
state: link | ||
force: True | ||
- name: Setup consent-telemetry no | ||
ansible.builtin.command: crc config set consent-telemetry no | ||
changed_when: False | ||
- name: Setup minimum packit-service memory requirements | ||
ansible.builtin.command: crc config set memory 13312 MiB | ||
changed_when: False | ||
- name: Setup minimum packit-service disk space requirements | ||
ansible.builtin.command: crc config set disk-size 60 Gi | ||
changed_when: False | ||
- name: Setup cluster | ||
ansible.builtin.command: crc setup | ||
changed_when: False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright Contributors to the Packit project. | ||
# SPDX-License-Identifier: MIT | ||
|
||
--- | ||
- name: Create vars/packit/dev.yml and deploy | ||
hosts: all | ||
vars: | ||
oc_download_link: https://mirror.openshift.com/pub/openshift-v4/amd64/clients/ocp/stable/openshift-client-linux.tar.gz | ||
test_project_name: myproject | ||
crc_url: https://api.crc.testing:6443 | ||
image: quay.io/packit/packit-service:stg | ||
image_worker: quay.io/packit/packit-worker:stg | ||
image_fedmsg: quay.io/packit/packit-service-fedmsg:stg | ||
image_dashboard: quay.io/packit/dashboard:stg | ||
image_tokman: quay.io/packit/tokman:stg | ||
tasks: | ||
- name: Enable EPEL repositories | ||
ansible.builtin.package: | ||
name: | ||
- epel-release | ||
become: true | ||
- name: Install packages for deployment | ||
ansible.builtin.package: | ||
name: | ||
- ansible | ||
- python3-openshift | ||
- python3-pip | ||
- python3-passlib # for using htpasswd ansible module | ||
- make | ||
- podman | ||
become: true | ||
|
||
- name: Download OC | ||
ansible.builtin.get_url: | ||
url: "{{ oc_download_link }}" | ||
dest: /tmp | ||
mode: "0644" | ||
register: download | ||
- name: Unarchive tarball in /usr/bin | ||
become: True | ||
ansible.builtin.unarchive: | ||
src: "{{ download.dest }}" | ||
dest: /usr/bin | ||
list_files: True | ||
remote_src: True |
Oops, something went wrong.