Skip to content

Instantly share code, notes, and snippets.

@tvieira
Forked from jasonbrooks/two-node-origin.md
Created May 3, 2018 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvieira/67e23cc139c8808948c61142ab5b91bf to your computer and use it in GitHub Desktop.
Save tvieira/67e23cc139c8808948c61142ab5b91bf to your computer and use it in GitHub Desktop.

Clone the openshift-ansible repo, check out the 3.9 branch.

# git clone https://github.com/openshift/openshift-ansible.git
# cd openshift-ansible
# git checkout release-3.9

Create an inventory, I'm calling it 2-node.yml, with contents like these, substituting your correct master and node hostnames:

# Create an OSEv3 group that contains the masters, nodes, and etcd groups
[OSEv3:children]
masters
nodes
etcd

# Set variables common for all OSEv3 hosts
[OSEv3:vars]
# SSH user, this user should allow ssh based auth without requiring a password
ansible_ssh_user=root

# If ansible_ssh_user is not root, ansible_become must be set to true
#ansible_become=true

openshift_deployment_type=origin

# uncomment the following to enable htpasswd authentication; defaults to DenyAllPasswordIdentityProvider
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]

# this will create admin/OriginAdmin, and user/OriginUser
openshift_master_htpasswd_users={'admin': '$apr1$zgSjCrLt$1KSuj66CggeWSv.D.BXOA1', 'user': '$apr1$.gw8w9i1$ln9bfTRiD6OwuNTG5LvW50'}

# host group for masters
[masters]
master.example.com

# host group for etcd
[etcd]
master.example.com

# host group for nodes, includes region info
[nodes]
master.example.com openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
node.example.com openshift_node_labels="{'region': 'primary', 'zone': 'default'}"

Run the prereq playbook, and then run the deploy playbook, and then make your admin user the cluster admin:

# ansible-playbook -i 2-node.yml playbooks/prerequisites.yml 
# ansible-playbook -i 2-node.yml playbooks/deploy_cluster.yml 
# ansible -i 2-node.yml masters -a 'oadm policy add-cluster-role-to-user cluster-admin admin'

You should be able to log in at https://master.example.com:8443/console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment