Running Ansible Cleanup
This article details how to clean up in the event that an install fails after running the Ansible install command. Cleaning up is key before running again, so that changes that are made are set in the new install.
For more information about the command, see the Recovering from a Cluster Installation Failure article in the Lightbits Installation and Configuration Guide.
You will need to reference the previously used parameters: $DOCKER_REPOSITORY_USERNAME
,$LB_ANSIBLE
.
Running the Lightbits Install Ansible Command
You can SSH into your Ansible installer VM using a method described in the SSH Into An Azure VM section.
- Remove the directory containing the Lightbits etcd certificates.
rm -rf ~/lb_install/lightos-certificates
- Use the following command to clean up a failed install of Lightbits, using Ansible running inside the
lb-ansible
container.
docker run -it --rm --net=host \
-e UID=`id -u` \
-e GID=`id -g` \
-e UNAME=$USER \
-v ~/lb_install/:/lb_install \
-w /lb_install \
docker.lightbitslabs.com/$DOCKER_REPOSITORY_USERNAME/lb-ansible:$LB_ANSIBLE \
sh -c 'ansible-playbook \
-i /lb_install/ansible/inventories/cluster_example/hosts \
/lb_install/playbooks/cleanup-lightos-playbook.yml --tags=cleanup'
Anatomy Of The Command
The docker run
command that will be used to run the cleanup can be confusing, so we have detailed the components of it into each section below.
Run Docker interactively, removing the container on exit and using the host network.
docker run -it --rm --net=host \
Use the current user-id within the container to prevent having to use root or sudo.
-e UID=`id -u` \
Use the current group-id within the container to prevent having to use root or sudo.
-e GID=`id -g` \
Set the current user to the container user to prevent having to use root or sudo.
-e UNAME=$USER \
Mount the working directory to /lb_install
inside the container.
-v ~/lb_install/:/lb_install \
Change the working directory inside the container to /lb_install
.
-w /lb_install \
Run the lb-ansible Docker container.
docker.lightbitslabs.com/$DOCKER_REPOSITORY_USERNAME/lb-ansible:$LB_ANSIBLE \
Run all text within the '
inside the lb-ansible container, starting with ansible-playbook
.
sh -c 'ansible-playbook \
Use the information inside the hosts
file that was previously configured.
-i /lb_install/ansible/inventories/cluster_example/hosts \
Run the cleanup-lightos-playbook.yml
playbook with verbosity.
/lb_install/playbooks/cleanup-lightos-playbook.yml --tags=cleanup'