The easiest way to start off is to clone and run the install script:
./install.sh
Ofc you need to have Ansible installed! ... and kubernetes python packages
- As namespaces/labels become groups, and Ansible do not support namespaces/labels with dashes(-).
- Dashes(-) will be replaced with underscores(_), remember that when using them!!!
- You have to set kubectl context before running ansible commands.
- Start tunneling for the device manually, and disable tunneling when done, all from the teknoir cloud console.
To see all ansible groups use the inventory command below.
Dashes(-) will be replaced with underscores(), remember that when limiting playbooks Device labels are concatenated with underscore i.e. f"{key}{value}" to create an ansible group name
Creates an inventory so you are able to connect to any device in any namespace. To see inventory run:
python3 inventory.py --list
ansible -i inventory.py --list-hosts all
ansible -i inventory.py --list-hosts <namespace>
Quick commands to manipulate devices
ansible <device_name> -m synchronize -a "src=/path/to/source/dir/ dest=/path/to/local/target/dir/ use_ssh_args=yes mode=pull"
Synchronize does not work with "become"(sudo)
ansible <device_name> -m synchronize -a "src=/path/to/local/source/dir/ dest=/path/to/target/dir/ use_ssh_args=yes"
Synchronize does not work with "become"(sudo)
Run for one device:
ansible-playbook -v -i inventory.py test-playbook.yaml --limit <device_name>
ansible-playbook -v -i inventory.py test-playbook.yaml --limit <namespace>
ansible-playbook -v -i inventory.py test-playbook.yaml --limit <label>
- Removed become=yes from inventory.py, so it is possible to run synchronize module, but it also means that you are no longer able to run commands that require sudo by default.