読者です 読者をやめる 読者になる 読者になる

nekop's blog

OpenShift / JBoss / WildFly / Infinispanの中の人 http://twitter.com/nekop

Fedora 24でOpenShift Originをセットアップする

Fedora 24にOpenShift Originが追加されたのでセットアップしてみる。以下の2ファイルを作ってvagrant upすればおしまい。インストールされるバージョンは1.2.0のようだ。

  • Vagrantfile
Vagrant.configure(2) do |config|
  config.vm.box = "fedora/24-cloud-base"
  config.vm.provision "shell", path: "vagrant-provision.sh"
  config.vm.network :private_network, ip: "192.168.232.101"
  config.vm.provider "libvirt" do |libvirt|
    libvirt.driver = "kvm"
    libvirt.memory = 2048
    libvirt.cpus = 4
  end
end
#!/bin/bash

IP_ADDR=192.168.232.101

sudo dnf install -y ansible pyOpenSSL python2-dnf git dbus-python libsemanage-python NetworkManager
sudo systemctl start NetworkManager
sudo systemctl enable NetworkManager
git clone https://github.com/openshift/openshift-ansible/
cat /dev/zero | ssh-keygen -q -N "" &> /dev/null # silent ssh-keygen
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh $IP_ADDR -o StrictHostKeyChecking=no id # add it to known_hosts
ANSIBLE_HOSTS=$(cat <<EOM
[OSEv3:children]
masters
nodes

[OSEv3:vars]
ansible_ssh_user=vagrant
ansible_become=true
deployment_type=origin
openshift_master_identity_providers=[{'name': 'allow_all', 'login': 'true', 'challenge': 'true', 'kind': 'AllowAllPasswordIdentityProvider'}]
osm_default_subdomain=apps.$IP_ADDR.xip.io

[masters]
$IP_ADDR openshift_node_labels="{'region': 'infra'}" openshift_schedulable=true

[nodes]
$IP_ADDR openshift_node_labels="{'region': 'infra'}" openshift_schedulable=true
EOM
)
echo "$ANSIBLE_HOSTS" | sudo sh -c "cat > /etc/ansible/hosts"
ansible-playbook ./openshift-ansible/playbooks/byo/config.yml