Use vagrant defaults for connection to test machine

Also add known_host add ssh_config accordingly
This commit is contained in:
Tunui Franken 2023-09-24 12:23:37 +02:00
parent ae5e3ec272
commit 7036dac3d3
5 changed files with 10 additions and 13 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
known_hosts
known_hosts.old
ssh_config
*.swp
.talismanrc
__pycache__

14
Vagrantfile vendored
View file

@ -2,18 +2,8 @@
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "lime2" do |lime2|
config.vm.define "lime2-test" do |lime2|
lime2.vm.box = "debian/bookworm64"
lime2.vm.hostname = "lime2"
lime2.vm.provision "shell" do |shell|
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
shell.inline = <<-SHELL
useradd #{ENV['USER']} -m -s /bin/bash
echo "#{ENV['USER']} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/#{ENV['USER']}
mkdir -p /home/#{ENV['USER']}/.ssh
echo #{ssh_pub_key} >> /home/#{ENV['USER']}/.ssh/authorized_keys
chown -R #{ENV['USER']}: /home/#{ENV['USER']}/.ssh
SHELL
end
lime2.vm.hostname = "lime2-test"
end
end

View file

@ -2,3 +2,6 @@
vault_password_file = get-vault-password.sh
stdout_callback = yaml
inventory = inventory.ini
[ssh_connection]
ssh_args = -o UserKnownHostsFile=known_hosts -F ssh_config

View file

@ -1 +1,2 @@
lime2
lime2-test remote_user=vagrant

View file

@ -1,7 +1,7 @@
---
- name: Install services for lime2 home server
gather_facts: true
hosts: lime2
hosts: lime2,lime2-test
roles:
- role: common
tags: [mail, forgejo, deuxpuissanceiks, tunuifranken]