Skip to content

Instantly share code, notes, and snippets.

@jasonbrooks
Last active May 3, 2018 16:37
Show Gist options
  • Save jasonbrooks/4243391b0ba25fe5c4139e36f1a5e06b to your computer and use it in GitHub Desktop.
Save jasonbrooks/4243391b0ba25fe5c4139e36f1a5e06b 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