Skip to content

Instantly share code, notes, and snippets.

@rhb2
Last active February 24, 2021 21:13
Show Gist options
  • Save rhb2/84e49d29d3b0d3491cc28332b9c9e557 to your computer and use it in GitHub Desktop.
Save rhb2/84e49d29d3b0d3491cc28332b9c9e557 to your computer and use it in GitHub Desktop.

smaug-ansible with vmware

Testing smaug-ansible changes can be done on a laptop. This is a guide to do so using vmware.

Prerequisites

The following must be installed on the host machine running the VMs:

  • Python 3.x
  • pip (Python package intaller)
  • jmespath (query language for JSON)
  • VMware Fusion 11.5.x or later (earlier versions could result in display problems for the VM)

Instructions

  • Clone the smaug-ansible repo on to your host system: git clone https://github.com/cloud-pi/smaug-ansible

  • Download 'minimal' centos7 iso

  • Create new virtual machine in vmware using that iso

    • 2G RAM
    • 2 CPU
    • Add a new 20G disk
  • CentOS7 install

    • select a disk for install
    • go to network settings and turn 'on' the NIC
    • perform install
    • set root password once install starts

Note: If your VM does not have an ip address on start, make sure that it is set to use NAT. If there is still a problem, login to the VM as root and run the following command: dhclient -v

  • Repeat VM creation two more times to create a total of three machines. These can be done in parallel.

  • Connect to the IAD001-dev VPN. If you have not done so, configure this VPN and connect to it. You will also need to add routes to your VPN configuration to send Artifactory traffic over the VPN. Follow the instructions in the artifactory.md file: artifactory.md

  • Apply vmware inventory patch

  $ git am 0001-vmware-inventory.patch
  • Replace inventory IPs with those from your VMs

    • nmcli will show IP addr within the VM
    • Modify inventories/vmware/standard_cluster_0001/hosts. The [machine_vmware] section is the only place in this file that needs to be updated.
  • Place the following in smaug-ansible/inventories/vmware/credential.json

{
  "artifactory_id": "joyent-gage",
  "artifactory_api_key": "AKCp5fTjoH7g4jBZiJR5TwHGVS5XZVNDAYkVcFBn8fK1kpLxPWMtsnFieBNfGAfNe4Xvhyehu",
  "artifactory_password": "jooc7EaNgaibahv"
}
  • Modify inventories/vmware/standard_cluster_0001/group_vars/foundationdb: Modify 'cluster_file' to use two IPs from your machines.

  • Copy your SSH key to each VM:

  $ mkdir ~/.ssh
  $ echo my_pub_key > ~/.ssh/authorized_keys
  • Disable firewalld on each node (firewalld: demerit)
  $ systemctl disable firewalld
  $ systemctl stop firewalld
  • Run the common setup routine. This downloads packages, formats & mnts disks...
  $ ./run-playbook.sh inventories/vmware/standard_cluster_0001 ./common_deploy.yml
  • Deploy Smaug and foundationdb
  $ ./run-playbook.sh inventories/vmware/standard_cluster_0001 ./smaug_deploy.yml

Other common operations

  • Delete all data and services by running smaug_destroy:
  $ ./run-playbook.sh inventories/vmware/standard_cluster_0001 ./smaug_destroy.yml
  • If you want to reset your env, run common_destroy and redeploy:
  $ ./run-playbook.sh inventories/vmware/standard_cluster_0001 ./common_destroy.yml
  $ ./run-playbook.sh inventories/vmware/standard_cluster_0001 ./common_deploy.yml
  $ ./run-playbook.sh inventories/vmware/standard_cluster_0001 ./smaug_deploy.yml
  • Verify the setup on all nodes.
  $ wizard admin status json -e http://10.88.88.150:9777
  $ wizard admin status json -e http://10.88.88.152:9777
  $ wizard admin status json -e http://10.88.88.153:9777

and

  $ curl -i -XPUT -d "hello world" "http://10.88.88.150:9700/api/v1/object/file1"
  $ curl -i -XPUT -d "hello world" "http://10.88.88.152:9700/api/v1/object/file2"
  $ curl -i -XPUT -d "hello world" "http://10.88.88.153:9700/api/v1/object/file3"
  • If you would like, follow a guide to configure the instances with static IPs. Ff you don't do this, the IPs may change when you reboot. This means you'll have to update IPs everywhere in Ansible and the fdb.cluster files on the Smaug nodes.

  • You may wish to add these VMs to your /etc/hosts file so you can use SSH referring to hostnames instead of IPs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment