Shorthand to run the ansible setup command

This commit is contained in:
Eric Paris 2015-05-30 11:26:04 -04:00
parent f66395283e
commit fec5e789fd
2 changed files with 36 additions and 13 deletions

View File

@ -4,13 +4,15 @@ This playbook helps you to set up a Kubernetes cluster on machines where you
can't or don't want to use the salt scripts and cluster up/down tools. They can't or don't want to use the salt scripts and cluster up/down tools. They
can be real hardware, VMs, things in a public cloud, etc. can be real hardware, VMs, things in a public cloud, etc.
## Usage ## Before starting
* Record the IP address of which machine you want to be your master * Record the IP address/hostname of which machine you want to be your master (only support a single master)
* Record the IP address of the machine you want to be your etcd server (often same as master) * Record the IP address/hostname of the machine you want to be your etcd server (often same as master, only one)
* Record the IP addresses of the machines you want to be your nodes. (master can be a node) * Record the IP addresses/hostname of the machines you want to be your nodes. (the master can also be a node)
Stick the system information into the 'inventory' file. ### Configure the inventory file
Stick the system information gathered above into the 'inventory' file.
### Configure your cluster ### Configure your cluster
@ -22,24 +24,27 @@ in full detail.
Now run the setup: Now run the setup:
$ ansible-playbook -i inventory cluster.yml `$ ./setup.sh`
In generel this will work on very recent Fedora, rawhide or F21. Future work to In generel this will work on very recent Fedora, rawhide or F21. Future work to
support RHEL7, CentOS, and possible other distros should be forthcoming. support RHEL7, CentOS, and possible other distros should be forthcoming.
### You can just set up certain parts instead of doing it all ### You can just set up certain parts instead of doing it all
Only the kubernetes daemons:
$ ansible-playbook -i inventory kubernetes-services.yml
Only etcd: Only etcd:
$ ansible-playbook -i inventory etcd.yml `$ ./setup.sh --tags=etcd`
Only flannel: Only the kubernetes master:
$ ansible-playbook -i inventory flannel.yml `$ ./setup.sh --tags=masters`
Only the kubernetes nodes:
`$ ./setup.sh --tags=nodes`
### You may overwrite the inventory file by doing
`INVENTORY=myinventory ./setup.sh`
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/contrib/ansible/README.md?pixel)]() [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/contrib/ansible/README.md?pixel)]()

18
contrib/ansible/setup.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
inventory=${INVENTORY:-inventory}
ansible-playbook -i ${inventory} cluster.yml $@