summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason DeTiberus <jdetiber@redhat.com>2015-04-28 14:07:31 -0400
committerJason DeTiberus <jdetiber@redhat.com>2015-04-28 14:14:02 -0400
commit75cc97d6bf45cd14a8d0017beb88dbbadb6dcd0e (patch)
tree46fdebd13352727168837770be27fb340934cc69
parenta83bea9a190fde22cceb6e3ef3d88a38e3eca1a4 (diff)
downloadopenshift-75cc97d6bf45cd14a8d0017beb88dbbadb6dcd0e.tar.gz
openshift-75cc97d6bf45cd14a8d0017beb88dbbadb6dcd0e.tar.bz2
openshift-75cc97d6bf45cd14a8d0017beb88dbbadb6dcd0e.tar.xz
openshift-75cc97d6bf45cd14a8d0017beb88dbbadb6dcd0e.zip
Add vagrantfile and minor bugfixes
- Add Vagrantfile for configuring a basic cluster - Add an initial readme for using vagrant - explicitly set connection: local and sudo: false for localhost actions in playbooks/common/openshift-node/config.yml - Fix permissions issue with openshift config file for non-root user
-rw-r--r--.gitignore1
-rw-r--r--README_vagrant.md25
-rw-r--r--Vagrantfile62
-rw-r--r--playbooks/common/openshift-node/config.yml4
-rw-r--r--roles/openshift_master/tasks/main.yml11
5 files changed, 103 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e25d99eeb..cacc711a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@
.DS_Store
gce.ini
multi_ec2.yaml
+.vagrant
diff --git a/README_vagrant.md b/README_vagrant.md
new file mode 100644
index 000000000..e3b3b5551
--- /dev/null
+++ b/README_vagrant.md
@@ -0,0 +1,25 @@
+Requirements
+------------
+- vagrant (tested against version 1.7.2)
+- vagrant-hostmaster plugin (tested against version 1.5.0)
+- vagrant-libvirt (tested against version 0.0.26)
+ - Only required if using libvirt instead of virtualbox
+
+Usage
+-----
+```
+vagrant up --no-provision
+vagrant provision
+```
+
+Using libvirt:
+```
+vagrant up --provider=libvirt --no-provision
+vagrant provision
+```
+
+Environment Variables
+---------------------
+The following environment variables can be overriden:
+- OPENSHIFT_DEPLOYMENT_TYPE (defaults to origin, choices: origin, enterprise, online)
+- OPENSHIFT_NUM_NODES (the number of nodes to create, defaults to 2)
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 000000000..648bc5171
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,62 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+VAGRANTFILE_API_VERSION = "2"
+
+unless Vagrant.has_plugin?("vagrant-hostmanager")
+ raise 'vagrant-hostmanager plugin is required'
+end
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+
+ deployment_type = ENV['OPENSHIFT_DEPLOYMENT_TYPE'] || 'origin'
+ num_nodes = (ENV['OPENSHIFT_NUM_NODES'] || 2).to_i
+
+ config.hostmanager.enabled = true
+ config.hostmanager.manage_host = true
+ config.hostmanager.include_offline = true
+ config.ssh.insert_key = false
+ config.vm.provider "virtualbox" do |vbox, override|
+ override.vm.box = "chef/centos-7.1"
+ vbox.memory = 1024
+ vbox.cpus = 2
+
+ # Enable multiple guest CPUs if available
+ vbox.customize ["modifyvm", :id, "--ioapic", "on"]
+ end
+
+ config.vm.provider "libvirt" do |libvirt, override|
+ libvirt.cpus = 2
+ libvirt.memory = 1024
+ libvirt.driver = 'kvm'
+ override.vm.box = "centos-7.1"
+ override.vm.box_url = "https://download.gluster.org/pub/gluster/purpleidea/vagrant/centos-7.1/centos-7.1.box"
+ override.vm.box_download_checksum = "b2a9f7421e04e73a5acad6fbaf4e9aba78b5aeabf4230eebacc9942e577c1e05"
+ override.vm.box_download_checksum_type = "sha256"
+ end
+
+ num_nodes.times do |n|
+ node_index = n+1
+ config.vm.define "node#{node_index}" do |node|
+ node.vm.hostname = "ose3-node#{node_index}.example.com"
+ node.vm.network :private_network, ip: "192.168.100.#{200 + n}"
+ end
+ end
+
+ config.vm.define "master" do |master|
+ master.vm.hostname = "ose3-master.example.com"
+ master.vm.network :private_network, ip: "192.168.100.100"
+ master.vm.network :forwarded_port, guest: 8443, host: 8443
+ master.vm.provision "ansible" do |ansible|
+ ansible.limit = 'all'
+ ansible.sudo = true
+ ansible.groups = {
+ "masters" => ["master"],
+ "nodes" => ["node1", "node2"],
+ }
+ ansible.extra_vars = {
+ openshift_deployment_type: "origin",
+ }
+ ansible.playbook = "playbooks/byo/config.yml"
+ end
+ end
+end
diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml
index 5a6c89489..433cfeb87 100644
--- a/playbooks/common/openshift-node/config.yml
+++ b/playbooks/common/openshift-node/config.yml
@@ -28,6 +28,8 @@
- name: Create temp directory for syncing certs
hosts: localhost
+ connection: local
+ sudo: false
gather_facts: no
tasks:
- name: Create local temp directory for syncing certs
@@ -112,6 +114,8 @@
- name: Delete temporary directory on localhost
hosts: localhost
+ connection: local
+ sudo: false
gather_facts: no
tasks:
- file: name={{ mktemp.stdout }} state=absent
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index 28bdda618..f9e6199a5 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -104,3 +104,14 @@
with_items:
- root
- "{{ ansible_ssh_user }}"
+
+- name: Update the permissions on the OpenShift client config(s)
+ file:
+ path: "~{{ item }}/.config/openshift/.config"
+ state: file
+ mode: 0700
+ owner: "{{ item }}"
+ group: "{{ item }}"
+ with_items:
+ - root
+ - "{{ ansible_ssh_user }}"