All Projects → geerlingguy → Ansible Role Packer_rhel

geerlingguy / Ansible Role Packer_rhel

Licence: mit
Ansible Role - Packer RHEL/CentOS Configuration for Vagrant VirtualBox

Projects that are alternatives of or similar to Ansible Role Packer rhel

ansible-role-packer-debian
Ansible Role - Packer Debian/Ubuntu Configuration for Vagrant VirtualBox
Stars: ✭ 32 (-28.89%)
Mutual labels:  build, packer, virtualbox, box, hashicorp, role
Ansible Role Repo Epel
Ansible Role - EPEL Repository for RHEL/CentOS
Stars: ✭ 149 (+231.11%)
Mutual labels:  redhat, ansible, centos, rhel, role
Packer Centos 6
This build has been moved - see README.md
Stars: ✭ 78 (+73.33%)
Mutual labels:  ansible, packer, centos, virtualbox, box
Packer Centos 7
This build has been moved - see README.md
Stars: ✭ 223 (+395.56%)
Mutual labels:  ansible, packer, centos, virtualbox, box
Packer Boxes
Jeff Geerling's Packer build configurations for Vagrant boxes.
Stars: ✭ 495 (+1000%)
Mutual labels:  ansible, packer, centos, virtualbox, box
Ansible Role Apache
Ansible Role - Apache 2.x.
Stars: ✭ 341 (+657.78%)
Mutual labels:  redhat, ansible, centos, rhel, role
Bento
Packer templates for building minimal Vagrant baseboxes for multiple platforms
Stars: ✭ 3,779 (+8297.78%)
Mutual labels:  redhat, packer, centos, rhel, virtualbox
Ansible Role Security
Ansible Role - Security
Stars: ✭ 398 (+784.44%)
Mutual labels:  redhat, ansible, centos, rhel, role
Packer Ubuntu 1404
DEPRECATED - Packer Example - Ubuntu 14.04 Vagrant Box using Ansible provisioner
Stars: ✭ 81 (+80%)
Mutual labels:  ansible, packer, virtualbox, box
docker-hands-on-guide
Hands on guide for docker, k8s cluster lightweight virtualization.
Stars: ✭ 25 (-44.44%)
Mutual labels:  packer, virtualbox, centos, redhat
Serverfarmer
Manage multiple servers with different operating systems, configurations, requirements etc. for many separate customers in an outsourcing model.
Stars: ✭ 122 (+171.11%)
Mutual labels:  redhat, ansible, centos, rhel
Docker Centos7 Ansible
CentOS 7 Docker container for Ansible playbook and role testing.
Stars: ✭ 72 (+60%)
Mutual labels:  redhat, ansible, centos, rhel
ansible-role-daemonize
Ansible Role - Daemonize.
Stars: ✭ 14 (-68.89%)
Mutual labels:  centos, redhat, rhel, role
Robox
The tools needed to robotically create/configure/provision a large number of operating systems, for a variety of hypervisors, using packer.
Stars: ✭ 303 (+573.33%)
Mutual labels:  packer, centos, rhel, virtualbox
Ansible Role Docker
Ansible Role - Docker
Stars: ✭ 845 (+1777.78%)
Mutual labels:  redhat, ansible, centos, role
Ansible Role Firewall
Ansible Role - iptables Firewall configuration.
Stars: ✭ 343 (+662.22%)
Mutual labels:  ansible, centos, rhel, role
local-hashicorp-stack
Local Hashicorp Stack for DevOps Development without Hypervisor or Cloud
Stars: ✭ 23 (-48.89%)
Mutual labels:  packer, virtualbox, hashicorp
Kubeadm Playbook
Fully fledged (HA) Kubernetes Cluster using official kubeadm, ansible and helm. Tested on RHEL/CentOS/Ubuntu with support of http_proxy, dashboard installed, ingress controller, heapster - using official helm charts
Stars: ✭ 533 (+1084.44%)
Mutual labels:  ansible, centos, rhel
ansible-role-backup
Ansible Role - Backup for simple servers
Stars: ✭ 122 (+171.11%)
Mutual labels:  centos, redhat, role
nginx-conf
Nginx configuration
Stars: ✭ 18 (-60%)
Mutual labels:  centos, redhat, rhel

Ansible Role: Packer RHEL/CentOS Configuration for Vagrant VirtualBox

CI

This role configures RHEL/CentOS (either minimal or full install) in preparation for it to be packaged as part of a .box file for Vagrant/VirtualBox deployment using Packer.

The role may be made more flexible in the future, so it could work with other Linux flavors and/or other Packer builders besides VirtualBox, but I'm currently only focused on VirtualBox, since the main use case right now is developer VMs.

Requirements

Prior to running this role via Packer, you need to make sure Ansible is installed via a shell provisioner, and that preliminary VM configuration (like adding a vagrant user to the appropriate group and the sudoers file) is complete, generally by using a Kickstart installation file (e.g. ks.cfg) with Packer. An example array of provisioners for your Packer .json template would be something like:

"provisioners": [
  {
    "type": "shell",
    "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
    "script": "scripts/ansible.sh"
  },
  {
    "type": "ansible-local",
    "playbook_file": "ansible/main.yml",
    "role_paths": [
      "/Users/jgeerling/Dropbox/VMs/roles/geerlingguy.packer_rhel",
    ]
  }
],

The files should contain, at a minimum:

scripts/ansible.sh:

#!/bin/bash -eux
# Add the EPEL repository, and install Ansible.
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y install ansible python-setuptools

ansible/main.yml:

---
- hosts: all
  sudo: yes
  gather_facts: yes
  roles:
    - geerlingguy.packer_rhel

You might also want to add another shell provisioner to run cleanup, erasing free space using dd, but this is not required (it will just save a little disk space in the Packer-produced .box file).

If you'd like to add additional roles, make sure you add them to the role_paths array in the template .json file, and then you can include them in main.yml as you normally would. The Ansible configuration will be run over a local connection from within the Linux environment, so all relevant files need to be copied over to the VM; configuratin for this is in the template .json file. Read more: Ansible Local Provisioner.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

packer_rhel_libselinux_package: libselinux-python

The libselinux python package to be installed. This is overridden for RHEL 8 to be python3-libselinux.

Dependencies

None.

Example Playbook

- hosts: all
  roles:
    - { role: geerlingguy.packer_rhel }

License

MIT / BSD

Author Information

This role was created in 2014 by Jeff Geerling, author of Ansible for DevOps.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].