From 924c97ddd4a2926deee9450ebf3327f817bc32dc Mon Sep 17 00:00:00 2001 From: Amit Sagtani Date: Sat, 14 Oct 2023 05:25:53 -0700 Subject: [PATCH] pickup valid changes from #656 --- ansible/inventory/offline/99-static | 2 +- bin/offline-cluster.sh | 45 ++++++++++++++++++++++------- offline/docs_ubuntu_22.04.md | 2 +- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/ansible/inventory/offline/99-static b/ansible/inventory/offline/99-static index fbc713ca1..a7b927751 100644 --- a/ansible/inventory/offline/99-static +++ b/ansible/inventory/offline/99-static @@ -100,7 +100,7 @@ # If you install restund together with other services on the same machine # you need to restund_allowed_private_network_cidrs to allow these services # to communicate on the private network. E.g. If your private network is 172.16.0.1/24 -# restund_allowed_private_network_cidrs = '["172.16.0.1/24"]' +# restund_allowed_private_network_cidrs = '["172.16.0.0/24"]' # Explicitely specify the restund user id to be "root" to override the default of "997" restund_uid = root diff --git a/bin/offline-cluster.sh b/bin/offline-cluster.sh index 988d7028c..d38986c1e 100755 --- a/bin/offline-cluster.sh +++ b/bin/offline-cluster.sh @@ -9,34 +9,59 @@ set -x ls $ANSIBLE_DIR/inventory/offline +if [ -f "$ANSIBLE_DIR/inventory/offline/hosts.ini" ] +then + INVENTORY_FILE="$ANSIBLE_DIR/inventory/offline/hosts.ini" +else + if [ -f "$ANSIBLE_DIR/inventory/offline/inventory.yml" ] + then + INVENTORY_FILE="$ANSIBLE_DIR/inventory/offline/inventory.yml" + else + { + echo "no inventory file in ansible/inventory/offline/. please supply an inventory.yml or hosts.ini." + exit -1 + } + fi +fi + +if [ -f "$ANSIBLE_DIR/inventory/offline/hosts.ini" ] && [ -f "$ANSIBLE_DIR/inventory/offline/inventory.ymp" ] +then + { + echo "both hosts.ini and inventory.yml provided in ansible/inventory/offline! pick only one." + exit -1 + } +fi + +echo "using ansible inventory: $INVENTORY_FILE" + # Populate the assethost, and prepare to install images from it. # # Copy over binaries and debs, serves assets from the asset host, and configure # other hosts to fetch debs from it. # # If this step fails partway, and you know that parts of it completed, the `--skip-tags debs,binaries,containers,containers-helm,containers-other` tags may come in handy. -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/setup-offline-sources.yml +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/setup-offline-sources.yml # Run kubespray until docker is installed and runs. This allows us to preseed the docker containers that # are part of the offline bundle -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/kubernetes.yml --tags bastion,bootstrap-os,preinstall,container-engine +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/kubernetes.yml --tags bastion,bootstrap-os,preinstall,container-engine # Install docker on the restund nodes -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/restund.yml --tags docker +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/restund.yml --tags docker # With ctr being installed on all nodes that need it, seed all container images: -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/seed-offline-containerd.yml +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/seed-offline-containerd.yml # Install NTP -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/sync_time.yml -v +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/sync_time.yml -v # Run the rest of kubespray. This should bootstrap a kubernetes cluster successfully: -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/kubernetes.yml --skip-tags bootstrap-os,preinstall,container-engine +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/kubernetes.yml --skip-tags bootstrap-os,preinstall,container-engine ./bin/fix_default_router.sh # Deploy all other services which don't run in kubernetes. -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/cassandra.yml -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/elasticsearch.yml -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/minio.yml -ansible-playbook -i $ANSIBLE_DIR/inventory/offline $ANSIBLE_DIR/restund.yml +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/cassandra.yml +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/elasticsearch.yml +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/minio.yml +ansible-playbook -i $INVENTORY_FILE $ANSIBLE_DIR/restund.yml diff --git a/offline/docs_ubuntu_22.04.md b/offline/docs_ubuntu_22.04.md index 2015a40e3..ca29bbf03 100644 --- a/offline/docs_ubuntu_22.04.md +++ b/offline/docs_ubuntu_22.04.md @@ -314,7 +314,7 @@ deeplink_title = "wire demo environment, example.com" [restund:vars] restund_uid = root -restund_allowed_private_network_cidrs='["172.16.0.1/24"]' +restund_allowed_private_network_cidrs='["172.16.0.0/24"]' [rmq-cluster:vars] rabbitmq_network_interface = enp1s0