Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding rhel-system-repo support for the lab #16

Merged
merged 3 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,30 @@ file_to_disk1 = './disk-0-1.vdi'
file_to_disk2 = './disk-0-2.vdi'
file_to_disk3 = './disk-0-3.vdi'
file_to_disk4 = './disk-0-4.vdi'
file_to_disk5 = './disk-1-3.vdi'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Use same SSH key for each machine
config.ssh.insert_key = false
config.vm.box_check_update = false

# Repo Server
# Repo
config.vm.define "repo" do |repo|
repo.vm.box = "rdbreak/rhel8repo"
# repo.vm.hostname = "repo.ansi.example.com"
repo.vm.box = "rdbreak/rhel8repo"
repo.vm.provider "virtualbox" do |repo|
repo.memory = "1024"
unless File.exist?(file_to_disk5)
repo.customize ['createhd', '--filename', file_to_disk5, '--variant', 'Standard', '--size', 2 * 1024]
repo.customize ['storagectl', :id, '--name', 'SATA Controller', '--add', 'sata', '--portcount', 1]
repo.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk5]
end
end
repo.vm.provision :shell, :inline => "pvs | grep '/dev/sdb' && echo 'The disk was already expanded!' || (pvcreate /dev/sdb; vgextend rhel_rhel8 /dev/sdb; lvextend -l +100%FREE /dev/rhel_rhel8/root; xfs_growfs /dev/rhel_rhel8/root)"

repo.vm.provision :shell, :inline => "sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config; sudo systemctl restart sshd;", run: "always"
repo.vm.provision :shell, :inline => "yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y; sudo yum install -y sshpass python3-pip python3-devel httpd sshpass vsftpd createrepo", run: "always"
repo.vm.provision :shell, :inline => " python3 -m pip install -U pip ; python3 -m pip install pexpect; python3 -m pip install ansible", run: "always"
repo.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: [".git/", "*.vdi"]
repo.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure, why vdi exclusion was removed, but this literally, break rsync process.
So, I would suggest to add that back:

repo.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: [".git/", "*.vdi"]

repo.vm.network "private_network", ip: "192.168.55.199"

repo.vm.provider "virtualbox" do |repo|
repo.memory = "512"
end
end

# Node 1
Expand Down
9 changes: 8 additions & 1 deletion playbooks/control.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
path: /etc/yum.repos.d/ipa.repo
state: touch
mode: 0755
- name: Adding the rhel-system-repos.rpm
copy:
src: rhel-system-roles-1.0.1-1.el8.noarch.rpm
dest: /home/vagrant
owner: vagrant
group: vagrant
mode: "0775"
- name: Building Repo File
copy:
dest: /etc/yum.repos.d/ipa.repo
Expand Down Expand Up @@ -114,4 +121,4 @@
#
# Repo/AppStream
# Available to use from http://repo.ansi.example.com/BaseOS and http://repo.ansi.example.com/AppStream
"
"
Binary file not shown.