Working setup

This commit is contained in:
lif
2025-10-17 14:11:52 +01:00
parent 5b3cd2b8b6
commit 492318c2e1
9 changed files with 49 additions and 173 deletions

33
vagrant/Vagrantfile vendored
View File

@@ -1,19 +1,26 @@
num_workers = 1
num_workers = 3
nodes = [
{
hostname: 'swarm-master',
ip: '192.168.56.10',
ram: 256,
cpus: 1,
groups: ['swarm_master'],
{
hostname: 'swarm-master',
ip: '192.168.56.10',
ram: 1024,
cpus: 1,
groups: ['swarm_master']
},
{
hostname: 'swarm-worker-storage',
ip: '192.168.56.11',
ram: 512,
cpus: 1,
groups: ['swarm_workers','storage']
}
]
(1..num_workers).each do |i|
nodes << {
hostname: "swarm-worker-#{i}",
ip: "192.168.56.#{10 + i}",
ip: "192.168.56.#{11 + i}",
ram: 256,
cpus: 1,
groups: ['swarm_workers']
@@ -49,11 +56,11 @@ Vagrant.configure('2') do |config|
# node_config.vm.box = 'generic/archlinux64'
# node_config.vm.box_version = "20250415.336224"
node_config.vm.network "private_network", ip: node[:ip]
node_config.vm.provider "virtualbox" do |vb|
vb.name = node[:hostname]
vb.memory = node[:ram]
vb.cpus = node[:cpus]
node_config.vm.network 'private_network', ip: node[:ip]
node_config.vm.provider 'virtualbox' do |vb|
vb.name = node[:hostname]
vb.memory = node[:ram]
vb.cpus = node[:cpus]
end
end
end

View File

@@ -3,15 +3,7 @@
become: true
tasks:
# write hello world to a file in the home directory
- name: write hello
copy:
content: "hello ansible!"
dest: /home/vagrant/hello.txt
mode: 0644
become: true
- name: Echo hello
shell: echo 'hello ansible!'
- name: Placeholder
shell: echo 'We don\'t use the setup playbook as they run in sequence. Better to run on the whole inventory after.'
args:
chdir: $HOME