Browse Source

Init

master
blallo 11 months ago
commit
7008a8fcd4
Signed by: blallo GPG Key ID: 0CBE577C9B72DC3F
  1. 1
      .vagrant/bundler/global.sol
  2. 1
      .vagrant/machines/debiantest/libvirt/action_provision
  3. 1
      .vagrant/machines/debiantest/libvirt/box_meta
  4. 1
      .vagrant/machines/debiantest/libvirt/creator_uid
  5. 1
      .vagrant/machines/debiantest/libvirt/id
  6. 1
      .vagrant/machines/debiantest/libvirt/index_uuid
  7. 1
      .vagrant/machines/debiantest/libvirt/synced_folders
  8. 1
      .vagrant/machines/debiantest/libvirt/vagrant_cwd
  9. 9
      .vagrant/rgloader/loader.rb
  10. 31
      Vagrantfile
  11. 3
      ansible.cfg
  12. 5
      handlers/main.yml
  13. 1
      inventory
  14. 8
      playbook.yml
  15. 75
      tasks/main.yml
  16. 6
      test_vars.yml

1
.vagrant/bundler/global.sol

@ -0,0 +1 @@
{"dependencies":[["formatador",["~> 0.2"]],["excon",["~> 0.49"]],["builder",[">= 0"]],["fog-core",["~> 1.43.0"]],["mini_portile2",["~> 2.4.0"]],["nokogiri",[">= 1.6.0"]],["json",[">= 0"]],["ruby-libvirt",[">= 0.7.0"]],["fog-xml",["~> 0.1.1"]],["multi_json",["~> 1.10"]],["fog-json",[">= 0"]],["fog-libvirt",[">= 0.3.0"]],["vagrant-libvirt",["= 0.0.45"]]],"checksum":"fffd3c92382f68b8c2b567be0284154ab699575030b9530f4eb9eaf340d61e70","vagrant_version":"2.2.9"}

1
.vagrant/machines/debiantest/libvirt/action_provision

@ -0,0 +1 @@
1.5:4a7308aa-0f0c-4650-960a-ab46a2f323a9

1
.vagrant/machines/debiantest/libvirt/box_meta

@ -0,0 +1 @@
{"name":"debian/buster64","version":"10.4.0","provider":"libvirt","directory":"boxes/debian-VAGRANTSLASH-buster64/10.4.0/libvirt"}

1
.vagrant/machines/debiantest/libvirt/creator_uid

@ -0,0 +1 @@
1000

1
.vagrant/machines/debiantest/libvirt/id

@ -0,0 +1 @@
4a7308aa-0f0c-4650-960a-ab46a2f323a9

1
.vagrant/machines/debiantest/libvirt/index_uuid

@ -0,0 +1 @@
1581929e88a845b69398f3a365a435c9

1
.vagrant/machines/debiantest/libvirt/synced_folders

@ -0,0 +1 @@
{}

1
.vagrant/machines/debiantest/libvirt/vagrant_cwd

@ -0,0 +1 @@
/home/leo/Documents/coding/playbooks/debian_toolbox/roles/syncthing

9
.vagrant/rgloader/loader.rb

@ -0,0 +1,9 @@
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.
if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end

31
Vagrantfile

@ -0,0 +1,31 @@
# This guide is optimized for Vagrant 1.7 and above.
# Although versions 1.6.x should behave very similarly, it is recommended
# to upgrade instead of disabling the requirement below.
Vagrant.require_version ">= 1.7.0"
Vagrant.configure(2) do |config|
config.vm.box = "debian/buster64"
config.vm.define "debiantest" do |m|
m.vm.hostname = "debiantest"
m.vm.network :private_network, ip: "192.168.123.2", libvirt__dhcp_enabled: false
m.vm.synced_folder ".", "/vagrant", disabled: true
end
# Disable the new default behavior introduced in Vagrant 1.7, to
# ensure that all Vagrant machines will use the same SSH key pair.
# See https://github.com/mitchellh/vagrant/issues/5005
config.ssh.insert_key = false
config.vm.provider :libvirt do |lv|
lv.cpus = 2
lv.memory = 1024
end
config.vm.provision "ansible" do |ansible|
ansible.become = true
ansible.verbose = "v"
ansible.playbook = "playbook.yml"
ansible.inventory_path = "inventory"
end
end

3
ansible.cfg

@ -0,0 +1,3 @@
[defaults]
roles_path = ../
ansible_python_interpreter = /usr/bin/python3

5
handlers/main.yml

@ -0,0 +1,5 @@
---
- name: restart syncthing
systemd:
state: restarted
name: syncthing@syncthing.service

1
inventory

@ -0,0 +1 @@
debiantest

8
playbook.yml

@ -0,0 +1,8 @@
---
- hosts: debiantest
gather_facts: yes
vars_files:
- ./test_vars.yml
roles:
- syncthing

75
tasks/main.yml

@ -0,0 +1,75 @@
---
- name: Ensure syncthing user is present
user:
name: syncthing
state: present
create_home: yes
home: "{{ syncthing.home }}"
shell: /usr/sbin/nologin
- name: Ensure syncthing dir is present
file:
path: "{{ syncthing.dir }}"
state: directory
owner: syncthing
group: syncthing
mode: 0700
- name: Ensure syncthing is installed
apt:
name:
- syncthing
- python-lxml
- python3-lxml
state: latest
- name: Ensure syncthing is running
systemd:
name: syncthing@syncthing.service
state: started
enabled: yes
- name: Set the sync directory
xml:
path: "{{ syncthing.home }}/.config/syncthing/config.xml"
xpath: /configuration/folder
attribute: path
value: "{{ syncthing.dir }}"
notify: restart syncthing
retries: 3
delay: 3
register: result
until: not result.failed
- name: Add an user to log into the interface
xml:
path: "{{ syncthing.home }}/.config/syncthing/config.xml"
xpath: /configuration/gui/user
value: "{{ syncthing.user }}"
notify: restart syncthing
retries: 3
delay: 3
register: result
until: not result.failed
- name: Set the password
xml:
path: "{{ syncthing.home }}/.config/syncthing/config.xml"
xpath: /configuration/gui/password
value: "{{ syncthing.password }}"
notify: restart syncthing
retries: 3
delay: 3
register: result
until: not result.failed
- name: Make public the management interface
xml:
path: "{{ syncthing.home }}/.config/syncthing/config.xml"
xpath: /configuration/gui/address
value: 0.0.0.0:8384
notify: restart syncthing
retries: 3
delay: 3
register: result
until: not result.failed

6
test_vars.yml

@ -0,0 +1,6 @@
---
syncthing:
dir: /syncthing
home: /var/syncthing
user: testuser
password: $6$ZFrzgBIbv/QuQz1S$QjorAV4gEyUHNO.PthWAe9utbNAd4vogAgLJTXuAt8bmK7.bc5za5kXKPLy.VFSuRtp9DVljRFhZm1LpV.c9Y0 # this is: password
Loading…
Cancel
Save