README.md 2.15 KB
Newer Older
k.elaammari's avatar
readme    
k.elaammari committed
1
2
# Long Term Storage Project
# Getting started 
Karim El Aammari's avatar
Karim El Aammari committed
3

k.elaammari's avatar
readme    
k.elaammari committed
4
5
## Publickeys
Publickeys added to this folder ```shared\authorized_keys.d``` will be added for authorization at the hypervisor and vm.
Karim El Aammari's avatar
Karim El Aammari committed
6

k.elaammari's avatar
readme    
k.elaammari committed
7
8
## Creating an diskimage
### Packer
Karim El Aammari's avatar
Karim El Aammari committed
9
10
11
12
13
14
15
16
17
1.Create a ed25519 host key with follwing name "ssh_host_ed25519_key" accordingly "ssh_host_ed25519_key.pub" and move it into prvisioning/secrets.

```shell
cd alxmonitoring/offline/packer/provisioning
mkdir secrets
cd secrets
ssh-keygen -t ed25519
```

k.elaammari's avatar
readme    
k.elaammari committed
18
2.Now you are ready to build the diskimage. Change into ```alxmonitoring/offline/packer``` folder and run the following command.
Karim El Aammari's avatar
Karim El Aammari committed
19
20
21
22
23

```shell
./build.sh archlinux-monitoring.json
```

k.elaammari's avatar
readme    
k.elaammari committed
24
### Ansible
Karim El Aammari's avatar
Karim El Aammari committed
25
26
27
28
29
30
31

4.Create the necessary TLS certificates with following script.

```shell
alxmonitoring/playbooks/files/openssl/script/generate.sh
```

k.elaammari's avatar
readme    
k.elaammari committed
32
5.Start the newly created diskimage with your local hypervisor and obtain the assigned ip address. e.g.:
Karim El Aammari's avatar
Karim El Aammari committed
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

```shell
arp -i %virtual_network_name% -n
```

6.Change into ```alxmonitoring``` folder and change in ```inventory.yml```the variable 'ansible_host' to your vm's ip address.

7.Before Ansible can configure and provision the vm, we need to set an sudo password for user anible. e.g:

```shell
ssh root@%ip% -i %your_key%
passwd ansible
```

8.To configure and provision the newly created vm, run follwing ansible-playbook command.

```shell
ansible-playbook alxmonitoring.yml --extra-vars "ansible_sudo_pass=%sudopassword%"
```
k.elaammari's avatar
readme    
k.elaammari committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

## Uploading diskimage to hypervisor
To upload your created diskimage to hypervisor into following folder. ```/var/lib/ltsvms/<dev|op>```

```shell
scp -i ~/.ssh/<key> diskimage/archlinux-monitoring root@mon-storage-test:/var/lib/ltsvms/dev
```

## Managing vm with virsh
### Connect virsh
```
virsh connect qemu:///system
```
Connects locally as the root user to the daemon supervising guest virtual machines on the KVM hypervisor.

### List all KVM guests (vms)
```
virsh list --all
```

### Install new VM
```
virt-install --help
```

### Show/Edit KVM vm configuration (libvirt-XML file)
```
virsh <dumxml|editxml> VM_NAME
```
### Start/Stop/Reboot
```
virsh <start|reboot|shutdown> VM_NAME
```
### Delete VM
```
virsh destroy VM_NAME && virsh undefine VM_NAME
```