mirror of
https://github.com/khuedoan/homelab.git
synced 2025-01-24 01:36:10 +07:00
Add test playbook
This commit is contained in:
parent
c349d2c994
commit
b3f7db200b
@ -2,16 +2,18 @@
|
||||
|
||||
NAME = homelab
|
||||
|
||||
default: run ansible
|
||||
|
||||
run:
|
||||
multipass list | grep $(NAME) \
|
||||
|| multipass launch \
|
||||
|| multipass launch \
|
||||
--cpus 4 \
|
||||
--mem 8G \
|
||||
--disk 64G \
|
||||
--cloud-init ./multipass-cloud-init.yaml \
|
||||
--name $(NAME) \
|
||||
release:20.10
|
||||
multipass shell $(NAME)
|
||||
multipass exec homelab -- sed -i "$$ a\$(shell cat ~/.ssh/id_rsa.pub)" /home/ubuntu/.ssh/authorized_keys
|
||||
|
||||
stop:
|
||||
multipass stop $(NAME)
|
||||
@ -19,3 +21,10 @@ stop:
|
||||
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
|
||||
|
5
test/hosts.ini
Normal file
5
test/hosts.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[metal]
|
||||
homelab ansible_host=192.168.64.5 ansible_user=ubuntu
|
||||
|
||||
[etcd]
|
||||
homelab
|
4
test/playbook.yml
Normal file
4
test/playbook.yml
Normal file
@ -0,0 +1,4 @@
|
||||
- name: Install etcd for Terraform state
|
||||
hosts: etcd
|
||||
roles:
|
||||
- { role: ../metal/roles/etcd, tag: etcd }
|
1
test/requirements.txt
Symbolic link
1
test/requirements.txt
Symbolic link
@ -0,0 +1 @@
|
||||
../metal/requirements.txt
|
Loading…
Reference in New Issue
Block a user