• Stars
    star
    169
  • Rank 224,453 (Top 5 %)
  • Language
    Shell
  • License
    GNU General Publi...
  • Created almost 11 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Helpful deployment scripts for Foreman and Katello

Forklift: lifting Foreman into your environment

Forklift provides tools to create Foreman/Katello environments for development, testing and production configurations. Whether you are a developer wanting an environment to write code, or a user wanting to spin up the latest production environment for deployment or evaluation Forklift has you covered.

Using Forklift

Requirements

  • Vagrant - 2.2+ - Both the VirtualBox and Libvirt providers are tested
  • Ansible - 2.12+
  • Vagrant Libvirt provider plugin (if using Libvirt)
  • Virtualization enabled in BIOS

See Installing Vagrant for installation instructions.

Quickstart

The quickstart guide covers the basic steps to install Forklift so that you can quickly spin up a production test environment of the latest bleeding edge nightly Foreman or Katello build.

It assumes you have already Vagrant and libvirt installed, as well as the vagrant-libvirt and vagrant-hostmanager plugins. You also need Ansible, although if you don't have it or aren't sure if your version is compatible, you can simply create and activate a Python virtual environment and then pip install ansible-galaxy

Start by cloning the Forklift repository:

git clone https://github.com/theforeman/forklift.git
cd forklift

Then install the Ansible collections which are needed by Forklift:

ansible-galaxy collection install -r requirements.yml

When this is complete, simply follow the next section of this README to try out the latest nightly Foreman build using Forklift.

Foreman Nightly Box

Spin up your box and start using the latest nightly build of Foreman:

vagrant up centos8-stream-foreman-nightly

Access the CLI by first connecting to the box via SSH:

vagrant ssh centos8-stream-foreman-nightly

To access the WebUI, it's helpful to have the vagrant-hostmanager plugin installed, so that your Workstation will automatically be able to resolve the hostname of the box to its IP address.

Then you can simply open your browser and navigate to https://centos8-stream-foreman-nightly.<HOSTNAME>.example.com where <HOSTNAME> is replaced by the shortname of your workstation. The first time you do this you will need to accept the self-signed certicate.

By default, forklift deploys Foreman with admin/changeme as username and password.

Katello Nightly Box

Katello nightly boxes are available as well; simply change centos8-stream-foreman-nightly to centos8-stream-katello-nightly and the steps are otherwise exactly the same as above.

Additional Documentation

The remainder of this README contains helpful notes on additional topics that are likely to be of interest to users. For the most thorough and complete guides however, please refer to the docs page.

Katello Development Environment

If you want a Katello development environment, substitute your GitHub username for GITHUB_NICK and run:

cp vagrant/boxes.d/99-local.yaml{.example,}
sed -i "s/<REPLACE ME>/GITHUB_NICK/g" vagrant/boxes.d/99-local.yaml

Bring up the Katello Development Box:

vagrant up centos8-katello-devel

Once the box is running, you can access the shell via SSH and modify the source code in the ~/foreman and ~/katello directories. Then start the application to preview your changes:

cd ~/foreman
bundle exec foreman start

Before you can access the WebUI, you must first accept the self-signed certificate on port 3808 by visiting https://centos8-katello-devel.<HOSTNAME>.example.com:3808 in your browser.

Then, navigate to https://centos8-katello-devel.<HOSTNAME>.example.com/ to access the WebUI and preview your changes.

As above, <HOSTNAME> refers to the shortname of your hypervisor.

There is a much more detailed guide to the development environments in the full documentation.

See the developer documentation within the Foreman and Katello repositories for instructions on running the test suites, submitting pull requests, etc.

Using Playbooks and Roles without Vagrant

In case using Vagrant is not desired, ansible playbooks and roles from this repo can be used separately. This is useful if an existing host should be used for the installation, e.g. a beaker machine. In order to deploy the devel environment on host test.example.com, the following needs to be done:

on test.example.com machine, where the dev env should be deployed

useradd vagrant
echo "vagrant	ALL=(ALL)	NOPASSWD: ALL" >> /etc/sudoers.d/vagrant

in forklift checkout

echo -e "[devel]\ntest.example.com" > inventories/local_inventory
ansible-playbook --private-key=~/.ssh/id_rsa --user root --inventory inventories/local_inventory --extra-vars katello_devel_github_username=katello playbooks/devel.yml

In an example above, ansible was instructed to use specific private key (overriding the value from ansible.cfg), root user was set as ssh user and playbook variable was set, so that checkout will be made from katello user.

Other playbooks from playbooks/ directory can be used similarly, though some might need more variables and investigating their parameters is recommended first.

Credentials

By default forklift deploys Foreman with admin/changeme as username and password, please change this on production installs (either after the install, or by setting foreman_installer_admin_password during the initial deployment).

Poor man's DNS a.k.a /etc/hosts

For the multi-host setup, one of the easiest way of making the name resolution working with vagrant is using vagrant-hostmanager. Forklift supports this plugin by default. The only thing one needs to do is install the vagrant-hostmanager plugin:

vagrant plugin install vagrant-hostmanager

By default, the boxes are set with example.com domain.

If you're using NetworkManager, this advanced DNS configuration allows completely automated dns resolution using dnsmasq from host to guest and guest to guest.

You can disable hostmanager in vagrant/settings.yaml by setting hostmanager_enabled option.

When using a briged network or with multiple network interfaces, the hostmanager would resolve the internal ip from the ssh-info, you can choose an ip of a particular network interface in vagrant/settings.yaml by setting hostmanager_ip_resolver_device option with the device name.

hostmanager_ip_resolver_device: 'eth1'

Adding Custom Boxes

Sometimes you want to spin up the same box type (e.g. centos8-katello-devel) from within the forklift directory. While this can be added to the Vagrantfile directly, updates to the forklift repository could wipe out your local changes. To help with this, you can define a custom box re-using the configuration within the Vagrantfile. To do so, create a 99-local.yaml file in vagrant/boxes.d/. For example, to create a custom box on CentOS 8 Stream with nightly and run the installers reset command:

my-nightly-koji:
  box: centos8-stream
  ansible:
    playbook: playbooks/katello.yml
    variables:
      katello_repositories_environment: staging
    verbose: vvv

Options:

Option Description
box the ':name' one of the defined boxes in the Vagrantfile
bridged deploy on Libvirt with a bridged networking configuration, value of this parameter should be the interface of the host (e.g. em1)
memory set the amount of memory (in megabytes) this box will consume
cpus set the number of cpus this box will use
hostname hostname to set on the box
networks custom networks to use in addition to the management network
disk_size specify the size (in gigabytes) of the box's virtual disk. This only sets the virtual disk size, so you will still need to resize partitions and filesystems manually.
add_disks (libvirt provider only) specify additional libvirt volumes
ansible updates the Ansible provisioner configuration including the playbook to be ran or any variables to set
libvirt_options sets Libvirt specific options, see config.rb from vagrant-libvirt for possible options
virtualbox_options sets VirtualBox specific options
openstack_options sets OpenStack specific options
google_options sets Google specific options
docker_options sets Docker specific options
domain forklift uses short name of your host + 'example.com' as domain name for your boxes. You can use this option to override it.
sshfs if you have vagrant-sshfs plugin, you can use sshfs to share folders between your host and guest. See an example below for details.
nfs share folders between host and guest. See an example below for details.
autostart set to true to automatically start when using 'vagrant up'
primary set the machine to be the default target of vagrant commands such as 'vagrant ssh'
libvirt_qemu_use_session Use qemu session instead of system

Entirely new boxes can be created that do not orginate from a box defined within the Vagrantfile. For example, if you had access to a RHEL Vagrant box:

rhel7:
  box_name: rhel7
  shell: 'echo TEST'
  pty: true
  libvirt: http://example.org/vagrant/rhel-7.box

Example with custom networking, static IP on custom libvirt network:

static:
  box: centos8
  hostname: mystatic.box.com
  networks:
    - type: 'private_network'
      options:
        ip: 192.168.150.3
        libvirt__network_name: lab-private
        libvirt__iface_name: vnet2

Example with custom libvirt management network:

static:
  box: centos8
  hostname: mystatic.box.com
  libvirt_options:
    management_network_address: 172.23.99.0/24

Example with openstack provider: You will need to install vagrant openstack provider. For more information click here. Do not forget to set openstack API credentials. To use openstack provider as default look here.

openstack-centos8:
  image_name: 'Centos8'
  username: 'centos'  #root by default
  hostname: 'john-doe'
  openstack_flavor: 'm1.medium'
  sync_type: 'disabled'

Using SSHFS to share folders

You will need to install vagrant-sshfs plugin. Make sure your host actually has sshfs installed. Example with sshfs mounting folder from guest to host:

with-sshfs:
  box: centos8
  sshfs:
    host_path: '/some/host/path'
    guest_path: '/some/guest/path'
    reverse: True

If you want to mount in the opposite direction, just change reverse to False or remove it entirely.

Additonal options may be specified with using options.

with-sshfs-options:
  box: centos8
  sshfs:
    host_path: '/some/host/path'
    guest_path: '/some/guest/path'
    options: '-o allow_other'

Example with an additional disk (libvirt volume) presented as /dev/vdb in the vm:

static:
  box: centos8
  hostname: mystatic.box.com
  add_disks:
    - size: 100GiB
      device: vdb
      type: qcow2

Using NFS to share folders

An alternative to SSHFS is to share the folders with NFS. It is slightly more work than SSHFS. See the Fedora developer documentation for information about how to configure an NFS server for Vagrant.

Then create your box:

with-nfs:
  box: centos8
  nfs:
    host_path: '/some/host/path'
    guest_path: '/some/guest/path'

Customize Deployment Settings

Some settings can be customized for the entirety of the deployment by copying vagrant/settings.yaml.example to vagrant/settings.yaml and add, remove or updating:

  • memory: Memory to give boxes by default unless specified by a box
  • cpus: Number of CPUs to give boxes by default unless specified by a box
  • scale_memory: Factor to multiply memory of boxes that specify an own value
  • scale_cpus: Factor to multiply CPUs of boxes that specify an own value
  • sync_type: type of sync to use for transfer to the Vagrant box
  • mount_options: options for the vagrant-cachier plugin
  • domain: domain for your hosts, you can override this per-box by configuring your box with a domain directly
  • libvirt_options, virtualbox_options, openstack_options, google_options: custom options for the various providers

Customize Available Boxes

The list of available boxes can be customized by setting an exclude list in vagrant/settings.yaml. This allows faster vagrant status calls as well as reducing the the scope of boxes a user sees to tailor to their use cases. To specify boxes to exclude add the following to vagrant/settings.yaml, for example, to remove fips, fedora and any Foreman 1.2X boxes from view:

boxes:
  exclude:
    - "katello" # exclude any box containing "katello"
    - "ubuntu1804-foreman-2\\.0" # exclude only the box "ubuntu1804-foreman-2.0". Notice the escaped '.' character to match the specific character instead of any single character
    - "^centos7-fips" # exclude any box that starts with "centos7-fips"
    - "foreman-1\\.(?:[2][0-3])" # exclude any foreman-1.20 to foreman-1.23 version box

Post Install Playbooks

Boxes can be further customized by declaring Ansible playbooks to be run during provisioning. One or more playbooks can be specified and will be executed sequentially. An ignored directory can be used to put playbooks into 'user_playbooks' without worrying about adding them during a git commit.

Ansible roles may also be installed directly using the ansible-galaxy command. These roles will be installed at playbooks/galaxy_roles and will be ignored by git. You may also specify roles in a requirements.yml, which you can use to install all desired roles with ansible-galaxy install -r requirements.yml

ansible:
  box: centos8-stream-katello-nightly
  ansible:
    playbook:
      - 'user_playbooks/vim.yml'
      - 'user_playbooks/zsh.yml'

Using Local Ansible Collection

If needing to use a local copy of an Ansible collection used by Forklift, such as developing updates to theforeman.operations collection, you can temporarily update the requirements.yml to point at your local checkout:

collections:
  - name: git+file:///home/user/path/to/repo/.git
    type: git

Then run ansible-galaxy install:

ansible-galaxy collection install -r requirements.yml --force-with-deps

More Repositories

1

foreman

an application that automates the lifecycle of servers
Ruby
2,398
star
2

foreman_ansible

▢️ Ansible integration in Foreman
JavaScript
211
star
3

smart-proxy

RESTful proxies for DNS, DHCP, TFTP, BMC and Puppet
Ruby
210
star
4

foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
Python
148
star
5

theforeman.org

The new and improved Foreman website.
HTML
144
star
6

community-templates

A place to share templates for various OSes for Foreman's provisioning
HTML
144
star
7

foreman_docker

This plugin enables management of Docker containers and images in Foreman
Ruby
117
star
8

foreman-installer

Automated Foreman installation and configuration
Ruby
116
star
9

foreman_fog_proxmox

Foreman plugin to add Proxmox compute resource based on fog-proxmox gem
Ruby
106
star
10

puppet-foreman

Puppet module for Foreman
Ruby
101
star
11

hammer-cli

Next-gen CLI tool for foreman
Ruby
94
star
12

puppet-puppet

Puppet module for Puppet client and server
Puppet
88
star
13

foreman_bootdisk

ISO and USB boot disk support for Foreman
JavaScript
76
star
14

foreman_ansible_inventory

Foreman dynamic inventory script for ansible - Now merged into Ansible itself
Python
70
star
15

safemode

A library for safe evaluation of Ruby code based on ParseTree/RubyParser and Ruby2Ruby. Provides Rails ActionView template handlers for ERB and Haml.
Ruby
68
star
16

foreman_salt

Foreman plug-in for Salt
Ruby
67
star
17

kafo

A gem for making installations based on puppet user friendly
Ruby
57
star
18

foreman_discovery

A plugin to enable Metal-as-a-Service discovery functionality in foreman
JavaScript
56
star
19

foreman_maintain

The Foreman/Satellite maintenance tool
Ruby
55
star
20

foreman_hooks

Run custom hook scripts on Foreman events
Ruby
53
star
21

puppet-foreman_proxy

Puppet module for Foreman Smart Proxy
Ruby
42
star
22

foreman-discovery-image

Foreman discovery image live distro
Ruby
39
star
23

foreman_openscap

Foreman plug-in for displaying OpenSCAP audit reports
JavaScript
39
star
24

foreman-packaging

Packaging files (RPMs, debs) for Foreman and its dependencies
39
star
25

foreman_templates

A plugin for Foreman to sync provisioning templates from an external source
JavaScript
39
star
26

hammer-cli-foreman

Next-gen CLI tool for foreman (Foreman-specific commands)
Ruby
37
star
27

staypuft

Openstack Foreman Installer
Ruby
34
star
28

puppetdb_foreman

PuppetDB proxy in Foreman
Ruby
32
star
29

foreman-tasks

Tasks management engine and plugin for Foreman
Ruby
31
star
30

foreman-digitalocean

Plugin to enable management of DigitalOcean droplets in Foreman
Ruby
29
star
31

foreman_remote_execution

A plugin bringing remote execution to the Foreman, completing the config management functionality with remote management functionality
JavaScript
29
star
32

foreman-xen

Provision and manage Xen Server in Foreman
Ruby
25
star
33

foreman_dhcp_browser

Web UI browser and editor for DHCP leases
Ruby
24
star
34

foreman-infra

Puppet modules and scripts to manage Foreman project infrastructure
Puppet
23
star
35

foreman_column_view

A simple Foreman plugin showcasing Deface for altering the Hosts view
Ruby
23
star
36

foreman_chef

Foreman extensions that are required for better Chef integration.
JavaScript
22
star
37

foreman_datacenter

This plugin lets you document your physical servers across multiple datacenters
Ruby
21
star
38

chef-handler-foreman

This handler allow Chef to send reports to Foreman
Ruby
20
star
39

foreman-documentation

Documentation for the Foreman Project and its ecosystem
SCSS
19
star
40

ldap_fluff

An LDAP gem for querying LDAP in various styles: Active Directory, FreeIPA & POSIX
Ruby
19
star
41

foreman_monitoring

Foreman plugin for monitoring system integration
Ruby
18
star
42

puppet-dhcp

ISC DHCP server module for Puppet
Ruby
18
star
43

puppet-dns

Installs and manages an ISC BIND DNS server with zones
Ruby
18
star
44

foreman_cockpit

πŸš€ Display console and journal of Cockpit-enabled hosts in Foreman - now replaced by Remote Execution's cockpit integration
Ruby
18
star
45

puppet-pulp

Puppet module for setting up Pulp 2 as part of Katello installation
Ruby
16
star
46

foreman_setup

Plugin for Foreman that helps set up provisioning
Ruby
15
star
47

journald-logger

RubyGem: Logger for systemd-journal
Ruby
15
star
48

smart_proxy_vault

Hashicorp Vault plugin for Smart Proxy
Ruby
14
star
49

foreman_api

[Deprecated][Archived] Ruby bindings for Forman's rest API
Ruby
14
star
50

puppet-foreman_scap_client

Puppet module for OpenSCAP
Ruby
13
star
51

foreman-installer-staypuft

Foreman installer plugin that helps with staypuft Foreman plugin installation
Ruby
13
star
52

puppet-tftp

Puppet module for managing tftp
Ruby
13
star
53

foreman-bats

BATS installation and cli end-to-end testing scripts
Shell
13
star
54

puppet-katello

Puppet module for setting Katello specific configuration. Also includes provider for manipulating with Katello resources.
Ruby
13
star
55

npm2rpm

🎁 Convert npm packages to RPM packages
JavaScript
12
star
56

smart_proxy_dns_infoblox

Ruby
12
star
57

puppet-git

Puppet module for git
Ruby
12
star
58

foreman_host_rundeck

API for Rundeck to pull host data from Foreman
Ruby
12
star
59

foreman_graphite

Send performance metrics to Graphite
Ruby
11
star
60

foreman-selinux

SELinux policy for Foreman
Shell
11
star
61

foreman_default_hostgroup

A plugin to set the default hostgroup when hosts are created.
Ruby
11
star
62

foreman-js

Foreman js tools
JavaScript
10
star
63

foreman-operations-collection

Ansible collection for management of Foreman servers
Makefile
10
star
64

obal

packaging wrapper using ansible
Python
9
star
65

smart_proxy_dns_route53

Route 53 DNS provider plugin for Foreman's smart proxy
Ruby
9
star
66

rfcs

RFCs for TheForeman
9
star
67

foreman_azure_rm

Adds Azure Resource Manager as a compute resource for The Foreman
JavaScript
9
star
68

foreman_memcache

Adds memcache integeration to foreman
Ruby
9
star
69

foreman_kubevirt

Kubevirt as compute resource for Foreman
JavaScript
9
star
70

foreman_pipeline

This project makes Foreman and Jenkins play together nicely. Jenkins can deploy stuff onto newly provisioned hosts by Foreman.
Ruby
9
star
71

smart_proxy_realm_ad_plugin

foreman-proxy realm plugin for Active Directory
Ruby
9
star
72

puppet-passenger

Deprecated puppet module for passenger, use puppetlabs-apache
Ruby
9
star
73

foreman_abrt

Foreman plugin for displaying reports from Automatic Bug Reporting Tool
Ruby
9
star
74

smart_proxy_dhcp_infoblox

foreman smart proxy for dhcp w/ infoblox
Ruby
9
star
75

smart_proxy_remote_execution_ssh

SSH remote execution provider for Foreman smart proxy
Ruby
8
star
76

foreman_omaha

Foreman Plugin to allow CoreOS Updates via Omaha Protocol.
Ruby
8
star
77

foreman_deployments

Plugin to support multi-host deployments
Ruby
8
star
78

smart_proxy_salt

Smart Proxy plug-in for Salt
Ruby
8
star
79

hammer-cli-foreman-ssh

Adds Remote SSH support for Hammer Foreman CLI
Ruby
7
star
80

puppet-apache

Deprecated puppet module for Apache webserver, use the puppetlabs one
Puppet
7
star
81

smart_proxy_dhcp_dnsmasq

dnsmasq DHCP plugin for Foreman smart-proxy
Ruby
7
star
82

foreman_puppet

JavaScript
7
star
83

smart_proxy_monitoring

Smart proxy plugin for monitoring system integration
Ruby
7
star
84

hammer-cli-foreman-admin

Plugin for Hammer CLI for administrative tasks on the Foreman and Smart Proxy servers.
Ruby
6
star
85

foreman-live

kickstart files to build a livecd with foreman pre-installed and configured on boot.
Shell
6
star
86

foreman_rh_cloud

a plugin to Foreman that generates and uploads reports to the Red Hat cloud
Ruby
6
star
87

smart_proxy_ansible

Ansible plugin for smart proxy, with Ansible remote execution provider
Ruby
6
star
88

smart_proxy_dhcp_bluecat

foreman smart proxy plugin for bluecat dhcp
Ruby
6
star
89

puppet-xinetd

Deprecated puppet module for xinetd, use the puppetlabs one
Puppet
6
star
90

smart_proxy_dns_powerdns

Foreman SmartProxy PowerDNS plugin
Ruby
6
star
91

foreman-bootloaders

Binary builds of PXE bootloaders from various Linux distributions
Shell
6
star
92

journald-native

systemd-journal logging interface wrapper for ruby
C
6
star
93

foreman_snapshot

Plugin to handle taking a snapshot of a host group and pushing it back to a Compute Resource as a new image
Ruby
5
star
94

foreman_virt_who_configure

JavaScript
5
star
95

foreman_azure

Old Plugin to have Azure as a Compute Resource in Foreman
Ruby
5
star
96

foreman_expire_hosts

Foreman plugin for limiting host lifetime
Ruby
5
star
97

puppet-certs

Puppet module for dealing with SSL certs across other modules used in Katello
Ruby
5
star
98

hammer_cli_foreman_remote_execution

CLI plugin for Remote Execution
Ruby
5
star
99

foreman_content

A content (Packages and Configuration) management plugin for Foreman
Ruby
5
star
100

smart_proxy_dhcp_remote_isc

Smart Proxy dhcp provider for NFS-accessible ISC dhcpd servers.
Ruby
5
star