diff options
author | Markos Chandras <mchandras@suse.de> | 2018-05-18 07:36:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-05-18 07:36:11 +0000 |
commit | 8de89f399e18ea3b29f5f19b7319a11d45fedbe0 (patch) | |
tree | 349dbbe42c41f4c98c153cbd2e7f426e4b5e7062 /xci/installer | |
parent | ca7b338b93affc2d1f08b6f47e7654f91653b47f (diff) | |
parent | 0ed80c59846e9e1b23d26869f05f109dac7495c5 (diff) |
Merge "xci: kubespray: Switch kubespray to dynamic inventory"
Diffstat (limited to 'xci/installer')
6 files changed, 17 insertions, 117 deletions
diff --git a/xci/installer/kubespray/deploy.sh b/xci/installer/kubespray/deploy.sh index 02a9d430..bcd7dc1d 100755 --- a/xci/installer/kubespray/deploy.sh +++ b/xci/installer/kubespray/deploy.sh @@ -28,8 +28,7 @@ echo "Info: Configuring localhost for kubespray" echo "-----------------------------------------------------------------------" cd $XCI_PLAYBOOKS ansible-playbook ${XCI_ANSIBLE_PARAMS} -e XCI_PATH="${XCI_PATH}" \ - -i ${XCI_FLAVOR_ANSIBLE_FILE_PATH}/inventory/inventory.cfg \ - configure-localhost.yml + -i dynamic_inventory.py configure-localhost.yml echo "-----------------------------------------------------------------------" echo "Info: Configured localhost for kubespray" @@ -46,9 +45,8 @@ echo "Info: Configured localhost for kubespray" echo "Info: Configuring opnfv deployment host for kubespray" echo "-----------------------------------------------------------------------" cd $K8_XCI_PLAYBOOKS -ansible-playbook ${XCI_ANSIBLE_PARAMS} -e XCI_PATH="${XCI_PATH}" \ - -i ${XCI_FLAVOR_ANSIBLE_FILE_PATH}/inventory/inventory.cfg \ - configure-opnfvhost.yml +ansible-playbook ${XCI_ANSIBLE_PARAMS} \ + -i ${XCI_PLAYBOOKS}/dynamic_inventory.py configure-opnfvhost.yml echo "-----------------------------------------------------------------------" echo "Info: Configured opnfv deployment host for kubespray" @@ -65,25 +63,23 @@ if [ $XCI_FLAVOR != "aio" ]; then echo "Info: Configuring target hosts for kubespray" echo "-----------------------------------------------------------------------" cd $K8_XCI_PLAYBOOKS - ansible-playbook ${XCI_ANSIBLE_PARAMS} -e XCI_PATH="${XCI_PATH}" \ - -i ${XCI_FLAVOR_ANSIBLE_FILE_PATH}/inventory/inventory.cfg \ - configure-targethosts.yml + ansible-playbook ${XCI_ANSIBLE_PARAMS} \ + -i ${XCI_PLAYBOOKS}/dynamic_inventory.py configure-targethosts.yml echo "-----------------------------------------------------------------------" echo "Info: Configured target hosts for kubespray" fi echo "Info: Using kubespray to deploy the kubernetes cluster" echo "-----------------------------------------------------------------------" -ssh root@$OPNFV_HOST_IP "set -o pipefail; cd releng-xci/.cache/repos/kubespray;\ - ansible-playbook \ - -i opnfv_inventory/inventory.cfg cluster.yml -b | tee setup-kubernetes.log" +ssh root@$OPNFV_HOST_IP "set -o pipefail; export XCI_FLAVOR=$XCI_FLAVOR; export INSTALLER_TYPE=$INSTALLER_TYPE; \ + cd releng-xci/.cache/repos/kubespray/; ansible-playbook \ + -i opnfv_inventory/dynamic_inventory.py cluster.yml -b | tee setup-kubernetes.log" scp root@$OPNFV_HOST_IP:~/releng-xci/.cache/repos/kubespray/setup-kubernetes.log \ - $LOG_PATH/setup-kubernetes.log + $LOG_PATH/setup-kubernetes.log cd $K8_XCI_PLAYBOOKS ansible-playbook ${XCI_ANSIBLE_PARAMS} \ - -i ${XCI_FLAVOR_ANSIBLE_FILE_PATH}/inventory/inventory.cfg \ - configure-kubenet.yml + -i ${XCI_PLAYBOOKS}/dynamic_inventory.py configure-kubenet.yml echo echo "-----------------------------------------------------------------------" echo "Info: Kubernetes installation is successfully completed!" diff --git a/xci/installer/kubespray/files/aio/inventory/inventory.cfg b/xci/installer/kubespray/files/aio/inventory/inventory.cfg deleted file mode 100644 index a72d0fec..00000000 --- a/xci/installer/kubespray/files/aio/inventory/inventory.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[all] -opnfv ansible_host=192.168.122.2 ip=192.168.122.2 - -[kube-master] -opnfv - -[kube-node] -opnfv - -[etcd] -opnfv - -[k8s-cluster:children] -kube-node -kube-master - -[calico-rr] - -[vault] -opnfv diff --git a/xci/installer/kubespray/files/ha/inventory/inventory.cfg b/xci/installer/kubespray/files/ha/inventory/inventory.cfg deleted file mode 100644 index aae36329..00000000 --- a/xci/installer/kubespray/files/ha/inventory/inventory.cfg +++ /dev/null @@ -1,32 +0,0 @@ -[all] -opnfv ansible_host=192.168.122.2 ip=192.168.122.2 -master1 ansible_host=192.168.122.3 ip=192.168.122.3 -master2 ansible_host=192.168.122.4 ip=192.168.122.4 -master3 ansible_host=192.168.122.5 ip=192.168.122.5 -node1 ansible_host=192.168.122.6 ip=192.168.122.6 -node2 ansible_host=192.168.122.7 ip=192.168.122.7 - -[kube-master] -master1 -master2 -master3 - -[kube-node] -node1 -node2 - -[etcd] -master1 -master2 -master3 - -[k8s-cluster:children] -kube-node -kube-master - -[calico-rr] - -[vault] -master1 -master2 -master3 diff --git a/xci/installer/kubespray/files/mini/inventory/inventory.cfg b/xci/installer/kubespray/files/mini/inventory/inventory.cfg deleted file mode 100644 index bf8bf19b..00000000 --- a/xci/installer/kubespray/files/mini/inventory/inventory.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[all] -opnfv ansible_host=192.168.122.2 ip=192.168.122.2 -master1 ansible_host=192.168.122.3 ip=192.168.122.3 -node1 ansible_host=192.168.122.4 ip=192.168.122.4 - -[kube-master] -master1 - -[kube-node] -node1 - -[etcd] -master1 - -[k8s-cluster:children] -kube-node -kube-master - -[calico-rr] - -[vault] -master1 diff --git a/xci/installer/kubespray/files/noha/inventory/inventory.cfg b/xci/installer/kubespray/files/noha/inventory/inventory.cfg deleted file mode 100644 index 73c1e0a1..00000000 --- a/xci/installer/kubespray/files/noha/inventory/inventory.cfg +++ /dev/null @@ -1,24 +0,0 @@ -[all] -opnfv ansible_host=192.168.122.2 ip=192.168.122.2 -master1 ansible_host=192.168.122.3 ip=192.168.122.3 -node1 ansible_host=192.168.122.4 ip=192.168.122.4 -node2 ansible_host=192.168.122.5 ip=192.168.122.5 - -[kube-master] -master1 - -[kube-node] -node1 -node2 - -[etcd] -master1 - -[k8s-cluster:children] -kube-node -kube-master - -[calico-rr] - -[vault] -master1 diff --git a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml index 0b38060b..c6b29dc0 100644 --- a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml +++ b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml @@ -34,16 +34,18 @@ file: path: "{{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory" state: absent - - name: copy kubespray inventory directory - command: "cp -rf {{ remote_xci_flavor_files }}/inventory \ - {{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory" - args: - creates: "{{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory" + - name: make sure kubespray/opnfv_inventory/group_vars/ exist file: path: "{{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory/group_vars" state: directory + - name: copy kubespray inventory directory + file: + src: "{{ remote_xci_playbooks }}/dynamic_inventory.py" + path: "{{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory/dynamic_inventory.py" + state: link + - name: Reload XCI deployment host facts setup: filter: ansible_local |