LXD role test

This commit is contained in:
Khue Doan 2021-02-15 14:33:51 +07:00
parent bac214e4dd
commit b4fc52b860
4 changed files with 23 additions and 15 deletions

View File

@ -2,9 +2,9 @@
NAME = homelab
default: run ansible
default: init metal infra
run:
init:
multipass list | grep $(NAME) \
|| multipass launch \
--cpus 4 \
@ -15,16 +15,22 @@ run:
release:20.10
multipass exec homelab -- sed -i "$$ a\$(shell cat ~/.ssh/id_rsa.pub)" /home/ubuntu/.ssh/authorized_keys
shell:
multipass shell $(NAME)
metal:
python3 -m venv .venv \
&& . .venv/bin/activate \
&& pip3 install --upgrade pip \
&& pip3 install -r requirements.txt \
&& ansible-playbook --inventory hosts.ini playbook.yml
infra:
echo infra
stop:
multipass stop $(NAME)
clean:
multipass delete $(NAME)
multipass purge
ansible:
python3 -m venv .venv \
&& . .venv/bin/activate \
&& pip3 install --upgrade pip \
&& pip3 install -r requirements.txt \
&& ansible-playbook --inventory hosts.ini playbook.yml

View File

@ -1,8 +1,6 @@
# Test
This will create a virtual machine on your laptop to emulate layer 0 (metal), you can run anything from layer 1 and up.
Requires `multipass`
Create a test environment in a Multipass VM (requires `multipass`)
```sh
make

4
test/ansible.cfg Normal file
View File

@ -0,0 +1,4 @@
[defaults]
host_key_checking = False
stdout_callback=debug
stderr_callback=debug

View File

@ -1,4 +1,4 @@
- name: Install etcd for Terraform state
hosts: etcd
- name: LXD
hosts: metal
roles:
- { role: ../metal/roles/etcd, tag: etcd }
- { role: ../metal/roles/lxd, tag: lxd }