From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 199CF2F56 for ; Mon, 28 Jul 2025 01:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753665284; cv=none; b=Z2EbzjNX7OWD4QVYYXjYwC6X45OyNODfoTH8vwVhzrxsB6O7dNhg9U7oRX/VECVhRg2UTc5I05HBur40zV0fM/cIRaSfQ47T+ZDT2NxpTB4vUJK0z4oRE9NRQrItRA/LrHjX9K4CmXC/FOCGPp5czYwOx4+VafpnzouKcsBBmoI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753665284; c=relaxed/simple; bh=XC5B8H9GDYxRS8rf1EBBh9KvcK6L++yjuWE0/AkomLA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kr3zz/YR/8fo312kIDnRmuIKyRr+Wek6BUmbYEnYbqyDj5qQ7QBvCsxBjdNE0j1jsWD/BA7snJfslau7VzjTWj8BKSXiB2nc7KBUnniC15eOECtckiOoUZQQ0DA4MiRrvoBqzb/s14qxo3dW3okHDhfgQ6dHH6JcGEeCbB9JLuY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=lBLzV6yi; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="lBLzV6yi" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=pY4HJW6OaSYQtfYe8WBgrIAo+wgjc35bmwQdEqxnirU=; b=lBLzV6yiyW1DoRz1sps80LPjA2 PiCj46L15U674t8necsSzYW6KoWi1N8nNy/jrf/0oN75vgc9eyNeFb/HX7IJvGXG2nBFFZ+1F7W4a jg8lBe14BDZsgHFPq2Q15n9XezbBMHunalV2kvhWoBL0Ntd+cKB134j1NEnkF3TlL/lFmfk4X+ZWG VZKFYD1ft9qb/1M8gS5Ximf4snjUjexwNNSEsizrzvkSYKEqxQVQrnuZhVZtBvXAIR7HNnWrlOVsD G9iHigBuDjZSE23PyeAAhfhfgR0Xw3Hr6GW1scwgf7Cpw0oTJ92l7QgOZw/xwDppuWpK5EIsQh4Jt 4egK8nOQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ugCRn-0000000DPis-2d5b; Mon, 28 Jul 2025 01:14:35 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Luis Chamberlain Subject: [PATCH v2 04/33] playbooks: remove Vagrant-specific playbooks and roles Date: Sun, 27 Jul 2025 18:14:04 -0700 Message-ID: <20250728011434.3197091-5-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250728011434.3197091-1-mcgrof@kernel.org> References: <20250728011434.3197091-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain Remove all Vagrant-related Ansible playbooks and roles: - install_vagrant_boxes.yml playbook and role - update_ssh_config_vagrant.yml playbook and role - Vagrantfile.j2 template from gen_nodes role This removes the complete Vagrant integration from the Ansible provisioning system. Generated-by: Claude AI Suggested-by: Chuck Lever Signed-off-by: Luis Chamberlain --- playbooks/install_vagrant_boxes.yml | 5 - .../roles/gen_nodes/templates/Vagrantfile.j2 | 478 ------------------ .../roles/install_vagrant_boxes/README.md | 46 -- .../install_vagrant_boxes/defaults/main.yml | 6 - .../scripts/add-box-if-missing.sh | 48 -- .../install_vagrant_boxes/tasks/main.yml | 49 -- .../roles/update_ssh_config_vagrant/README.md | 66 --- .../defaults/main.yml | 13 - .../python/update_ssh_config.py | 1 - .../update_ssh_config_vagrant/tasks/main.yml | 69 --- .../update_ssh_config/.gitignore | 6 - .../update_ssh_config/.travis.yml | 12 - .../update_ssh_config/CONTRIBUTING | 49 -- .../update_ssh_config/LICENSE | 239 --------- .../update_ssh_config/Makefile | 15 - .../update_ssh_config/README.md | 159 ------ .../test_update_ssh_config.py | 417 --------------- .../tests/0001_remove_hosts_top.orig | 53 -- .../tests/0001_remove_hosts_top.res | 33 -- .../tests/0002_remove_hosts_middle.orig | 53 -- .../tests/0002_remove_hosts_middle.res | 33 -- .../tests/0003_remove_hosts_bottom.orig | 53 -- .../tests/0003_remove_hosts_bottom.res | 33 -- .../tests/0004_remove_hosts_missing.orig | 33 -- .../tests/0004_remove_hosts_missing.res | 33 -- .../tests/0005_remove_hosts_similar.orig | 53 -- .../tests/0005_remove_hosts_similar.res | 53 -- .../tests/0006_add_hosts_manual.orig | 33 -- .../tests/0006_add_hosts_manual.res | 53 -- ..._remove_hosts_two_separate_ops_top.add.res | 53 -- ...add_remove_hosts_two_separate_ops_top.orig | 53 -- ...move_hosts_two_separate_ops_top.remove.res | 33 -- .../0008_add_remove_hosts_one_shot_top.orig | 1 - .../0008_add_remove_hosts_one_shot_top.res | 1 - ..._hosts_vagrant_emulate_top.emulate_vagrant | 20 - .../0009_add_hosts_vagrant_emulate_top.orig | 1 - .../0009_add_hosts_vagrant_emulate_top.res | 53 -- ...rithms_vagrant_emulate_top.emulate_vagrant | 20 - ...sts_kexalgorithms_vagrant_emulate_top.orig | 53 -- ...osts_kexalgorithms_vagrant_emulate_top.res | 55 -- ...two_separate_ops_kexalgorithms_top.add.res | 55 -- ...ts_two_separate_ops_kexalgorithms_top.orig | 53 -- ..._separate_ops_kexalgorithms_top.remove.res | 33 -- .../0012_add_remove_hosts_empty_file.res | 20 - .../update_ssh_config/update_ssh_config.py | 325 ------------ .../update_ssh_config_vagrant/vars/main.yml | 1 - playbooks/update_ssh_config_vagrant.yml | 4 - 47 files changed, 3028 deletions(-) delete mode 100644 playbooks/install_vagrant_boxes.yml delete mode 100644 playbooks/roles/gen_nodes/templates/Vagrantfile.j2 delete mode 100644 playbooks/roles/install_vagrant_boxes/README.md delete mode 100644 playbooks/roles/install_vagrant_boxes/defaults/main.yml delete mode 100755 playbooks/roles/install_vagrant_boxes/scripts/add-box-if-missing.sh delete mode 100644 playbooks/roles/install_vagrant_boxes/tasks/main.yml delete mode 100644 playbooks/roles/update_ssh_config_vagrant/README.md delete mode 100644 playbooks/roles/update_ssh_config_vagrant/defaults/main.yml delete mode 120000 playbooks/roles/update_ssh_config_vagrant/python/update_ssh_config.py delete mode 100644 playbooks/roles/update_ssh_config_vagrant/tasks/main.yml delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/.gitignore delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/.travis.yml delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/CONTRIBUTING delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/LICENSE delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/Makefile delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/README.md delete mode 100755 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/test_update_ssh_config.py delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0001_remove_hosts_top.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0001_remove_hosts_top.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0002_remove_hosts_middle.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0002_remove_hosts_middle.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0003_remove_hosts_bottom.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0003_remove_hosts_bottom.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0004_remove_hosts_missing.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0004_remove_hosts_missing.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0005_remove_hosts_similar.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0005_remove_hosts_similar.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0006_add_hosts_manual.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0006_add_hosts_manual.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.add.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.remove.res delete mode 120000 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0008_add_remove_hosts_one_shot_top.orig delete mode 120000 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0008_add_remove_hosts_one_shot_top.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.emulate_vagrant delete mode 120000 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.emulate_vagrant delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.add.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.orig delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.remove.res delete mode 100644 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0012_add_remove_hosts_empty_file.res delete mode 100755 playbooks/roles/update_ssh_config_vagrant/update_ssh_config/update_ssh_config.py delete mode 100644 playbooks/roles/update_ssh_config_vagrant/vars/main.yml delete mode 100644 playbooks/update_ssh_config_vagrant.yml diff --git a/playbooks/install_vagrant_boxes.yml b/playbooks/install_vagrant_boxes.yml deleted file mode 100644 index 8cffb36a..00000000 --- a/playbooks/install_vagrant_boxes.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - tasks: - - include_role: - name: install_vagrant_boxes diff --git a/playbooks/roles/gen_nodes/templates/Vagrantfile.j2 b/playbooks/roles/gen_nodes/templates/Vagrantfile.j2 deleted file mode 100644 index a52f5566..00000000 --- a/playbooks/roles/gen_nodes/templates/Vagrantfile.j2 +++ /dev/null @@ -1,478 +0,0 @@ -# -*- mode: ruby -*- -# # vi: set ft=ruby : -# Automatically generated file by kdevops {{ kdevops_version }} - -# This file should only be edited to *grow* support for new features. -# This file is automatically created for you from a jinja2 template file -# and parsed with ansible after extra_vars.yaml file is created. The source is -# playbooks/roles/gen_nodes/templates/Vagrantfile.j2 - -Vagrant.require_version ">= 1.6.0" - -require 'json' -require 'yaml' -require 'fileutils' -require 'rbconfig' - -@os = RbConfig::CONFIG['host_os'] - -# XXX: upstream libvirt enhancement needed -# -# Vagrant allows multiple provider code to be supported easily, however -# this logic assuems all provider setup is supported through configuration -# variables from the provider. This is not the case for libvirt. We need -# to create the qemu image, and the libvirt vagrant provider doesn't have -# support to create the images as virtual box does. We run the commands -# natively, however this also reveals that on execution path even code -# for other providers gets executed regardless of the provider you are -# using *unless* that code is using provider specific variables. Best we -# can do for now is detect your OS and set a local variable where we *do* -# run different local code paths depending on the target provider. -# -# Right now we make these assumptions: -# -# Your OS Provider -# ------------------------------- -# Linux libirt -# Mac OS X virtualbox -provider = "libvirt" - -# Are we in a nested virtualized environment? For now we just -# do something different if we're not on bare metal. We may want -# to do something different later to optimize this further but -# we have to draw the line somewhere. -nested = %x(which systemd-detect-virtd 1>/dev/null 2>&1 || systemd-detect-virt) != "none" - -case -when @os.downcase.include?('linux') - provider = "libvirt" -when @os.downcase.include?('darwin') - provider = "virtualbox" -else - puts "You OS hasn't been tested yet, go add support and send a patch." - exit -end - -# We assume if you are in kdevops/vagrant/ your project namespace is kdevops -project_namespace = File.basename(File.dirname(Dir.getwd)) - -node_config = "kdevops_nodes.yaml" -node_config_override = "kdevops_nodes_override.yaml" - -config_data = YAML.load_file(node_config) - -override_data = false -if File.file?(node_config_override) - override_data = true - config_data_override = YAML.load_file(node_config_override) -end - -global_data = config_data['vagrant_global'] -vagrant_boxes = config_data['vagrant_boxes'] - -if override_data - if config_data_override['vagrant_global'] - global_data = config_data_override['vagrant_global'] - end - if config_data_override['vagrant_boxes'] - vagrant_boxes = config_data_override['vagrant_boxes'] - end -end - -supported_provider = case provider - when "virtualbox" then true - when "libvirt" then true - else false -end - -if ! supported_provider - puts "Unsupported provider: #{provider} on " + RbConfig::CONFIG['host_os'] - puts "Consider adding support and send a patch" - exit -end - -qemu_group = global_data['libvirt_cfg']['qemu_group'] -qemu_group_auto = global_data['libvirt_cfg']['qemu_group_auto'] - -if qemu_group_auto - if File.exist?('/etc/debian_version') - qemu_group = 'libvirt-qemu' - else - qemu_group = 'qemu' - end -end - -kdevops_pool_path = global_data['storage_pool_path'] - -libvirt_session_public_network_dev = global_data['libvirt_cfg']['session_public_network_dev'] - -Vagrant.configure("2") do |config| - vagrant_boxes.each do |server_data| - if Vagrant.has_plugin?("vagrant-timezone") - config.timezone.value = "{{ kdevops_host_timezone.stdout }}" - end - # Using sync folders won't work for say openstack / aws / azure / gce, and - # for that we'll use terraform, so best to allow whatever data we want to - # sync be provisioned with ansible. - config.vm.synced_folder './', '/vagrant', type: '9p', disabled: true, accessmode: "mapped", mount: false - config.vm.define server_data["name"] do |srv| - srv.vm.box = server_data['box'] ? server_data['box'] : global_data["box"] - server_box_version = server_data['box_version'] ? server_data['box_version'] : global_data["box_version"] - if server_box_version != "" - srv.vm.box_version = server_box_version - end -{% if not libvirt_session %} - if ! nested - srv.vm.network "private_network", ip: server_data["ip"] - end -{% endif %} - host_name = server_data["name"] - node_custom_data_path = kdevops_pool_path + "/#{host_name}" - FileUtils.mkdir_p(node_custom_data_path) unless File.exist?(node_custom_data_path) - extra_disk_path = "#{node_custom_data_path}/" + "{{ extra_disk_path }}" - FileUtils.mkdir_p(extra_disk_path) unless File.exist?(extra_disk_path) -{% if libvirt_enable_cxl %} - cxl_path = "#{node_custom_data_path}" + "/cxl" - FileUtils.mkdir_p(cxl_path) unless File.exist?(cxl_path) -{% endif %} -{% if virtualbox_provider %} - srv.vm.provider "virtualbox" do |vb, override| - if provider == "virtualbox" && ! global_data['virtualbox_cfg']['auto_update'] - # we'll need to run later: vagrant vbguest install - config.vbguest.auto_update = false - end - override.vm.hostname = host_name - override.vm.boot_timeout = global_data['boot_timeout'] - vb.memory = global_data["memory"] - vb.cpus = global_data["cpus"] - if global_data['extra_disks'] - port = 0 - port_count = global_data['extra_disks'].size() - global_data['extra_disks'].each do |key, value| - size = value['size'] - # The "purpose" value below is currently an unused label at - # the moment. The serial number is we really use with the - # /dev/disk-id to ensure the extra drives are used as intended. - purpose = key - port_plus = port + 1 - extra_disk = extra_disk_path + "/{{ extra_disk_driver }}#{port}n#{port_plus}.{{ libvirt_extra_drive_format }}" - - # "Standard" provides a sparse file. That's what we want, we cheat - # the OS and only use what we need. If you want the real file size - # add a global config option and send a patch and justify it. I'd - # like to hear about it. We use sparse files for libvirt as well - # and should try to keep setup in sync. - if (! File.file?(extra_disk)) - vb.customize ["createmedium", "disk", "--filename", extra_disk, "--variant", "Standard", "--format", "{{ libvirt_extra_drive_format | upper }}", "--size", size] - end - # Virtualbox supports only one nvme controller... this will fail - # unless you are a Virtualbox hacker adding support for this :) - if global_data['virtualbox_cfg']['nvme_controller_per_disk'] - # https://www.virtualbox.org/manual/ch08.html#vboxmanage-storagectl - # This command attaches, modifies, and removes a storage - # controller. After this, virtual media can be attached to the - # controller with the storageattach command. - extra_drive_name = "{{ extra_disk_driver }}#{port}" - if (! File.file?(extra_disk)) - vb.customize ["storagectl", :id, "--name", "#{extra_drive_name}", "--add", "pcie", "--controller", "{{ extra_disk_controller }}", "--portcount", 1, "--bootable", "off"] - end - # Now attach the drive - vb.customize ["storageattach", :id, "--storagectl", "#{extra_drive_name}", "--type", "hdd", "--medium", extra_disk, "--port", 0] - else - if (port == 0 && !File.file?(extra_disk)) - vb.customize ["storagectl", :id, "--name", "{{ extra_disk_driver }}0", "--add", "pcie", "--controller", "{{ extra_disk_controller }}", "--portcount", port + 1, "--bootable", "off"] - end - vb.customize ["storageattach", :id, "--storagectl", "{{ extra_disk_driver }}0", "--type", "hdd", "--medium", extra_disk, "--port", port] - end - - if global_data['enable_sse4'] - # Support for the SSE4.x instruction is required in some versions of VB. - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"] - vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"] - end - port += 1 - end # end of looping all extra disks - end # end of checking for extra disks - end # end of virtualbox provider section -{% endif %} -{% if libvirt_provider %} - # For details see: https://github.com/vagrant-libvirt/vagrant-libvirt - srv.vm.provider "libvirt" do |libvirt, override| - #libvirt.host = "localhost" - override.vm.hostname = host_name - override.vm.boot_timeout = global_data['boot_timeout'] - libvirt.watchdog :model => 'i6300esb', :action => 'reset' - libvirt.storage_pool_path = kdevops_pool_path -{% if libvirt_host_passthrough %} - libvirt.cpu_mode = 'host-passthrough' -{% endif %} -{% if libvirt_storage_pool_create %} - libvirt.storage_pool_name = '{{ libvirt_storage_pool_name }}' -{% endif %} -{% if libvirt_session %} - libvirt.qemu_use_session = true - libvirt.uri = global_data['libvirt_cfg']['uri'] - libvirt.system_uri = global_data['libvirt_cfg']['system_uri'] - libvirt.socket = global_data['libvirt_cfg']['session_socket'] - libvirt.management_network_device = global_data['libvirt_cfg']['session_management_network_device'] -{% else %} - if nested - libvirt.management_network_name = 'vagrant-libvirt-private' - libvirt.management_network_address = '192.168.124.0/24' - libvirt.management_network_device = global_data['libvirt_cfg']['session_management_network_device'] - end -{% endif %} - libvirt.memory = global_data["memory"] - libvirt.cpus = global_data["cpus"] - libvirt.emulator_path = global_data['libvirt_cfg']['emulator_path'] - if server_data["machine_type"] - libvirt.machine_type = server_data["machine_type"] - else - if global_data['libvirt_cfg']['machine_type'] - libvirt.machine_type = global_data['libvirt_cfg']['machine_type'] - end - end - # Add an extra spare PCI or PCI-E root bus to be used for extra drives. - # - # We use a dedicated PCI or PCI-E root bus to not clash with defaults - # which libvirt may use on PCI root bus (pci.0 if PCI, pcie.0 if PCI-E). - # For a while in kdevops we were not clashing with the defaults brought - # up by libvirt-qemu, however recent versions seem to start clashing up - # to pci.0,addr=0x3 so we'd see an error like: - # - # PCI: slot 3 function 0 not available for virtio-blk-pci, in use by nvme,id=(null) (Libvirt::Error) - # - # Just create a PCI or PCI-E root bus dedicated for extra drives. We - # use 0x08 to place this PCI / PCI-E root bus as we know this is - # available on modern x86-64 systems. Eventually we may need to bump - # this to 0x9, but it would be better instead to have vagant-libvirt - # speak "add a new PCI or PCI-E root bus" and "add extra drives" whether - # that is nvme or virtio. - # -{% if not libvirt_override_machine_type %} - # For i440x on x86_64 (default on libvirt as of today) we use PCI, not - # PCI-E. Below assumes i440x. i440x cannot support CXL as it does not - # support PCI-E. - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "pci-bridge,id=custom-pci-for-{{ extra_disk_driver }},chassis_nr=1,bus=pci.0,addr=0x8" -{% else %} -{% if libvirt_machine_type == "q35" %} - libvirt.qemuargs :value => "-global" - libvirt.qemuargs :value => "ICH9-LPC.disable_s3=0" - libvirt.qemuargs :value => "-global" - libvirt.qemuargs :value => "ICH9-LPC.disable_s4=0" -{% endif %} - # This is for exclusive PCIe hierarchies. - # - # For 'q35' on x86_64 and 'virt' for AArch64 we use can use PCI-E - # only hierarchies. - # - # We add a dedicated PCI root bus (pxb-pcie) just for dedicated PCI - # root ports for extra drives, this will be pcie.1. - # - # We can keep doing this to support new technologies. For instance, - # it may be reasonable to add a PCI-E root bus also to support PCI-E - # hotplug on PCI-E capable systems and avoid clashes with libvirt - # defaults on pcie.0. CXL uses its own host bridge so device - # enumeration is pretty well isolated already so no need to do anything - # extra there. - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "pxb-pcie,id=pcie.1,bus_nr=32,bus=pcie.0,addr=0x8" -{% if libvirt_enable_cxl %} - libvirt.qemuargs :value => "-machine" - libvirt.qemuargs :value => "cxl=on" - cpus = global_data["cpus"] - memory = global_data["memory"] - libvirt.numa_nodes = [ - {:cpus => "0-#{cpus - 1}", :memory => global_data["memory"]} - ] - libvirt.qemuargs :value => "-m" - libvirt.qemuargs :value => "maxmem=#{memory *2}M,slots=16" - # CXL host bus - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "pxb-cxl,bus=pcie.0,id=cxl.0,bus_nr=52,addr=0x9" - - - cxl_mem1_path = cxl_path + "/cxl-mem1.raw" - libvirt.qemuargs :value => "-object" - libvirt.qemuargs :value => "memory-backend-file,id=kdevops-cxl-mem1,share=on,mem-path=#{cxl_mem1_path},size=4G" - - # Label Storage Area, used to store CXL namespace labels and region labels - cxl_lsa1_path = cxl_path + "/cxl-lsa1.raw" - libvirt.qemuargs :value => "-object" - libvirt.qemuargs :value => "memory-backend-file,id=kdevops-cxl-lsa1,share=on,mem-path=#{cxl_lsa1_path},size=256M" - - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "cxl-rp,port=0,bus=cxl.0,id=kdevops_cxl_root_port0,chassis=0,slot=2" - -{% if libvirt_enable_cxl_demo_topo2 %} - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "cxl-rp,port=1,bus=cxl.0,id=kdevops_cxl_root_port1,chassis=0,slot=3" -{% endif %} # TOPO 2 - - -{% if libvirt_enable_cxl_switch_topo1 %} - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "cxl-upstream,bus=kdevops_cxl_root_port0,id=kdevops_cxl_us0,addr=0.0,multifunction=on" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "cxl-switch-mailbox-cci,bus=kdevops_cxl_root_port0,addr=0.1,target=kdevops_cxl_us0" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "cxl-downstream,port=0,bus=kdevops_cxl_us0,id=kdevops_cxl_swport0,chassis=0,slot=4" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "cxl-downstream,port=1,bus=kdevops_cxl_us0,id=kdevops_cxl_swport1,chassis=0,slot=5" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "cxl-type3,bus=kdevops_cxl_swport0,memdev=kdevops-cxl-mem1,lsa=kdevops-cxl-lsa1,id=kdevops-cxl-pmem0" -{% else %} # !switch topo1 - {% if not libvirt_enable_cxl_dcd_topo1 %} - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "cxl-type3,bus=kdevops_cxl_root_port0,memdev=kdevops-cxl-mem1,lsa=kdevops-cxl-lsa1,id=kdevops-cxl-pmem0" - {% else %} # dcd_topo1 - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "cxl-type3,bus=kdevops_cxl_root_port0,nonvolatile-dc-memdev=kdevops-cxl-mem1,lsa=kdevops-cxl-lsa1,id=kdevops-cxl-dcd0,num-dc-regions=2" - {% endif %} # dcd topo1 -{% endif %} # !switch topo1 - libvirt.qemuargs :value => "-M" - libvirt.qemuargs :value => "cxl-fmw.0.targets.0=cxl.0,cxl-fmw.0.size=8G" -{% if libvirt_enable_qmp %} - libvirt.qemuargs :value => "-qmp" -{% if libvirt_qemu_qmp_wait %} - libvirt.qemuargs :value => "{{ libvirt_qemu_qmp_string }},wait=on" -{% else %} # !qmp_wait - libvirt.qemuargs :value => "{{ libvirt_qemu_qmp_string }},wait=off" -{% endif %} # libvirt_qemu_qmp_wait -{% endif %} # libvirt_enable_qmp -{% endif %} # CXL -{% endif %} - - if server_data['pcipassthrough'] - server_data['pcipassthrough'].each do |key, value| - libvirt.pci :domain => value['domain'], :bus => value['bus'], :slot => value['slot'], :function => value['function'] - end - end - if global_data['extra_disks'] - port = 0 - port_count = global_data['extra_disks'].size() - global_data['extra_disks'].each do |key, value| - size = value['size'] - zoned = value['zoned'] - largio = value['largio'] - if zoned && !global_data['enable_zns'] - next - end - extra_drive_largio_args="" - if zoned - logical_block_size = value['logical_block_size'] - physical_block_size = value['physical_block_size'] - zone_size = value['zone_size'] - zone_capacity = value['zone_capacity'] - zone_max_open = value['zone_max_open'] - zone_max_active = value['zone_max_active'] - zone_zasl = value['zone_zasl'] - end - if largio - largeio_logical_block_size = value['logical_block_size'] - largeio_physical_block_size = value['physical_block_size'] - extra_drive_logical_block_size_args = "logical_block_size=#{largeio_logical_block_size}" - extra_drive_physical_block_size_args = "physical_block_size=#{largeio_physical_block_size}" - extra_drive_largio_args=",#{extra_drive_logical_block_size_args},#{extra_drive_physical_block_size_args}" - end - purpose = key - port_plus = port + 1 - key_id_prefix = "{{ libvirt_extra_drive_id_prefix }}" - disk_id = "#{key_id_prefix}#{port}" - serial_id = "kdevops#{port}" - extra_disk_name = "{{ extra_disk_driver }}#{port}n#{port_plus}.{{ libvirt_extra_drive_format }}" - extra_disk = extra_disk_path + "/" + "#{extra_disk_name}" - unless File.exist? (extra_disk) - if provider == "libvirt" - cmd = "qemu-img create -f {{ libvirt_extra_drive_format }} #{extra_disk} #{size}M" - ok = system(cmd) - if ! ok - puts "Command failed: #{cmd}" - exit - end - end - end -{% if not libvirt_override_machine_type %} - bus_for_extra_drives = "custom-pci-for-{{ extra_disk_driver }}" - pci_function = 0 + port -{% else %} - # A PCI-E root port must be added per extra drive. - # Chassis must be something unique for the entire topology it seems (?) - chassis = 50 + port - bus_for_extra_drives = "pcie-port-for-{{ extra_disk_driver }}-#{port}" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "pcie-root-port,id=#{bus_for_extra_drives},multifunction=on,bus=pcie.1,addr=0x#{port},chassis=#{chassis}" - pci_function = "0x0" -{% endif %} -{% if libvirt_extra_storage_drive_ide %} - libvirt.qemuargs :value => "-drive" - libvirt.qemuargs :value => "file=#{extra_disk},format={{ libvirt_extra_drive_format }},aio={{ libvirt_extra_storage_aio_mode }},cache={{ libvirt_extra_storage_aio_cache_mode }},if=ide,serial=#{serial_id}" -{% elif libvirt_extra_storage_drive_virtio %} - virtio_pbs = "{{ libvirt_extra_storage_virtio_physical_block_size }}" - virtio_lbs = "{{ libvirt_extra_storage_virtio_logical_block_size }}" - libvirt.qemuargs :value => "-object" - libvirt.qemuargs :value => "iothread,id=kdevops-virtio-iothread-#{port}" - libvirt.qemuargs :value => "-drive" - libvirt.qemuargs :value => "file=#{extra_disk},format={{ libvirt_extra_drive_format }},if=none,aio={{ libvirt_extra_storage_aio_mode }},cache={{ libvirt_extra_storage_aio_cache_mode }},id=#{disk_id}" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "virtio-blk-pci,drive=#{disk_id},id=virtio-#{disk_id},serial=#{serial_id},bus=#{bus_for_extra_drives},addr=#{pci_function},iothread=kdevops-virtio-iothread-#{port}#{extra_drive_largio_args},logical_block_size=#{virtio_lbs},physical_block_size=#{virtio_pbs}" -{% elif libvirt_extra_storage_drive_scsi %} - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "virtio-scsi-pci,id=scsi#{port},bus=#{bus_for_extra_drives},addr=#{pci_function}" - libvirt.qemuargs :value => "-drive" - libvirt.qemuargs :value => "file=#{extra_disk},format={{ libvirt_extra_drive_format }},if=none,aio={{ libvirt_extra_storage_aio_mode }},cache={{ libvirt_extra_storage_aio_cache_mode }},id=#{disk_id}" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "scsi-hd,drive=#{disk_id},bus=scsi#{port}.0" -{% elif libvirt_extra_storage_drive_nvme %} - if ! largio - nvme_lbs = "{{ libvirt_extra_storage_nvme_logical_block_size }}" - extra_drive_largio_args=",logical_block_size=#{nvme_lbs},physical_block_size=#{nvme_lbs}" - end - extra_drive_interface = "none" - if zoned - libvirt.qemuargs :value => "-drive" - libvirt.qemuargs :value => "file=#{extra_disk},format={{ libvirt_extra_drive_format }},aio={{ libvirt_extra_storage_aio_mode }},cache={{ libvirt_extra_storage_aio_cache_mode }},if=#{extra_drive_interface},id=#{disk_id}" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "nvme,id={{ extra_disk_driver }}#{port},serial=#{serial_id},bus=#{bus_for_extra_drives},addr=#{pci_function},zoned.zasl=#{zone_zasl}" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "nvme-ns,drive=#{disk_id},bus={{ extra_disk_driver }}#{port},nsid=1,logical_block_size=#{logical_block_size},physical_block_size=#{physical_block_size},zoned=true,zoned.zone_size=#{zone_size},zoned.zone_capacity=#{zone_capacity},zoned.max_open=#{zone_max_open},zoned.max_active=#{zone_max_active}" - else - libvirt.qemuargs :value => "-drive" - libvirt.qemuargs :value => "file=#{extra_disk},format={{ libvirt_extra_drive_format }},aio={{ libvirt_extra_storage_aio_mode }},cache={{ libvirt_extra_storage_aio_cache_mode }},if=#{extra_drive_interface},id=#{disk_id}" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "nvme,id={{ extra_disk_driver }}#{port},serial=#{serial_id},bus=#{bus_for_extra_drives},addr=#{pci_function}" - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "nvme-ns,drive=#{disk_id},bus={{ extra_disk_driver }}#{port},nsid=1#{extra_drive_largio_args}" - end -{% endif %} - port += 1 - end - if provider == "libvirt" - cmd = "sudo chgrp -R #{qemu_group} #{node_custom_data_path}" - ok = system("#{cmd}") - if ! ok - puts "Command failed: #{cmd}" - exit - end - cmd = "sudo chmod -R g+rw #{node_custom_data_path}" - ok = system("#{cmd}") - if ! ok - puts "Command failed: #{cmd}" - exit - end - end # end of provider check for libvirt - end # end of check for extra disks for libvirt -{% if bootlinux_9p %} - - libvirt.qemuargs :value => "-device" - libvirt.qemuargs :value => "{{ bootlinux_9p_driver }},fsdev={{ bootlinux_9p_fsdev }},mount_tag={{ bootlinux_9p_mount_tag }},bus=pcie.0,addr=0x10" - libvirt.qemuargs :value => "-fsdev" - libvirt.qemuargs :value => "local,id={{ bootlinux_9p_fsdev }},path={{ bootlinux_9p_host_path }},security_model={{ bootlinux_9p_security_model }}" - -{% endif %} - end # end of libvirt provider code -{% endif %} - end # end of srv defined loop - end # end of vagrant_boxes loop -end diff --git a/playbooks/roles/install_vagrant_boxes/README.md b/playbooks/roles/install_vagrant_boxes/README.md deleted file mode 100644 index b755febc..00000000 --- a/playbooks/roles/install_vagrant_boxes/README.md +++ /dev/null @@ -1,46 +0,0 @@ -install-vagrant-boxes -===================== - -The ansible install-vagrant-boxes role lets you get install additional vagrant -boxes which may be outside of the public catalog. - -Requirements ------------- - -Run system using vagrant. - -Role Variables --------------- - - * kdevops_install_vagrant_boxes: set to True to enable installing boxes - * vagrant_boxes: this role is designed so that you override this varaible - your own list of boxes. - -Dependencies ------------- - -None. - -Example Playbook ----------------- - -Below is an example playbook, say a install-vagrant-boxes-sle.yml file which -would try to install the aarch64 vagrant boxes for SLE using some URLs you -have access to: - -``` ---- -- hosts: localhost - tasks: - - include_role: - name: install-vagrant-boxes - vars: - vagrant_boxes: - - { name: 'suse/sle12sp5.aarch64', box_url: 'http://some.com/SLES12-SP5-Vagrant.aarch64-12.5-libvirt_aarch64-GM.vagrant.libvirt.box' } - - { name: 'suse/sle15sp2.aarch64', box_url: 'http://some.com/SLES15-SP2-Vagrant.aarch64-15.2-libvirt_aarch64-Snapshot2.vagrant.libvirt.box' } -``` - -License -------- - -copyleft-next-0.3.1 diff --git a/playbooks/roles/install_vagrant_boxes/defaults/main.yml b/playbooks/roles/install_vagrant_boxes/defaults/main.yml deleted file mode 100644 index 13165a7c..00000000 --- a/playbooks/roles/install_vagrant_boxes/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# Example boxes with URLs. You would override this. -kdevops_install_vagrant_boxes: False -vagrant_boxes: - - { name: 'suse/sle12sp5.x86_64', box_url: 'http://example.com/SLE-12-SP5-Vagrant-GM/SLES12-SP5-Vagrant.x86_64-12.5-libvirt-GM.vagrant.libvirt.box' } - - { name: 'suse/sle15sp2.x86_64', box_url: 'http://example.com/SLES15-SP2-Vagrant.x86_64-15.2-libvirt-Snapshot2.vagrant.libvirt.box' } diff --git a/playbooks/roles/install_vagrant_boxes/scripts/add-box-if-missing.sh b/playbooks/roles/install_vagrant_boxes/scripts/add-box-if-missing.sh deleted file mode 100755 index b14a52f3..00000000 --- a/playbooks/roles/install_vagrant_boxes/scripts/add-box-if-missing.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Looks to see if a vagrant box is present -# Vagrant lacks the ability to tell you if a box is present in one -# single command line so we have to wrap this up for it. - -TMP_FILE="" - -box_search_finish() -{ - if [[ ! -z $TMP_FILE ]]; then - rm -f $TMP_FILE - fi -} - -trap "box_search_finish" EXIT - -if [[ $# -ne 2 ]]; then - echo "Usage: $0 " - exit 1 -fi - -BOX=$1 -BOX_URL=$2 - -BOX_SEARCH="$1\s\+" -TMP_FILE=$(mktemp) - -vagrant box list > $TMP_FILE -grep -q "$BOX_SEARCH" $TMP_FILE -if [ $? -eq 0 ] ; then - exit 0 -else - NAME_ARGS="" - echo $BOX_URL | grep -q json$ - # Sadly we cannot rename boxes in json format, so we must stick to - # what is given. - if [[ $? -ne 0 ]]; then - NAME_ARGS="--name $BOX" - fi - vagrant box add --provider=libvirt --insecure $NAME_ARGS $BOX_URL - RET=$? - # We use a special return value to indicate change to the - # ansible script, so that it can tell a change has occurred. - if [ $RET -eq 0 ]; then - exit 314 - fi - exit $RET -fi diff --git a/playbooks/roles/install_vagrant_boxes/tasks/main.yml b/playbooks/roles/install_vagrant_boxes/tasks/main.yml deleted file mode 100644 index 430050f5..00000000 --- a/playbooks/roles/install_vagrant_boxes/tasks/main.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- name: Import optional extra_args file - include_vars: "{{ item }}" - ignore_errors: yes - with_first_found: - - files: - - "../extra_vars.yml" - - "../extra_vars.yaml" - - "../extra_vars.json" - skip: true - tags: vars - -- name: Import optional distribution specific variables - include_vars: "{{ item }}" - ignore_errors: yes - with_first_found: - - files: - - "{{ ansible_facts['os_family']|lower }}.yml" - skip: true - tags: vars - -- name: Verify vagrant installation - command: "which vagrant" - register: vagrant_present - changed_when: vagrant_present.rc == 0 - failed_when: vagrant_present.rc != 0 - tags: [ 'vagrant', 'verify' ] - when: - - kdevops_install_vagrant_boxes|bool - -# vagrant has no single command line to check for this so we have to -# wrap it up ourselves, and we only add a box if not present -- name: Add vagrant box if not present - shell: | - set -o pipefail - {{ role_path }}/scripts/add-box-if-missing.sh {{ item.name }} {{ item.box_url }} - args: - executable: /bin/bash - chdir: "{{ role_path }}" - register: box_check - changed_when: box_check.rc == 314 - failed_when: ( box_check.rc not in [ 0, 314, 58 ] ) - with_items: - - "{{ vagrant_boxes }}" - loop_control: - label: "Adding vagrant box {{ item.name }} if not present" - tags: [ 'vagrant', 'box', 'install' ] - when: - - kdevops_install_vagrant_boxes|bool diff --git a/playbooks/roles/update_ssh_config_vagrant/README.md b/playbooks/roles/update_ssh_config_vagrant/README.md deleted file mode 100644 index ddd6989d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/README.md +++ /dev/null @@ -1,66 +0,0 @@ -update_ssh_config_vagrant -========================= - -Update your `~/.ssh/config` with the same information vagrant has. -If you `vagrant destroy -f` and then `vagrant up` and information -has changed, this role will delete old stale entries and replace -them with the new ones. - -Care must be taken as this *does* update your local user's ~/.ssh/config by -default. That is, this role is intended to be run locally, never on virtual -host, unless of course you are doing nested virtualization. - -Development notes ------------------ -The code for updating your ssh configuration is shared with terraform. -We do this by having the code for this ansible role effectively -present on this ansible role through a git subtree within kdevops. -The code upstream on that tree is used to publish a terraform module: - - * https://registry.terraform.io/modules/mcgrof/add-host-ssh-config - -To learn how to make changes to the shared code read: - - * [update_ssh_config documentation](playbooks/roles/update_ssh_config_vagrant/update_ssh_config/README.md) - -Requirements ------------- - -You can use this if you are using vagrant to deploy guests. - -Role Variables --------------- - - * sshconfig: your ssh configuration file - * sshconfig_backup: where to dump the backup file - * vagrant_dir: the location of your vagrant deployment - * kexalgorithms: if set, this sets a custom ssh KexAlgorithms, useful - on older hosts - -Dependencies ------------- - -You should be using vagrant if you are using this role. Your system -isa lso expected to have some sort of .ssh/config file. This runs -*locally* on your system. - -Example Playbook ----------------- - -Below is an example playbook, say a update_ssh_config_vagrant.yml file, this -would be fine if your vagrant deployment is located on ../vagrant/ directory: - -``` ---- -- hosts: localhost - roles: - - role: update_ssh_config_vagrant -``` - -For further examples refer to one of this role's users, the -[https://github.com/mcgrof/kdevops](kdevops) project. - -License -------- - -copyleft-next-0.3.1 diff --git a/playbooks/roles/update_ssh_config_vagrant/defaults/main.yml b/playbooks/roles/update_ssh_config_vagrant/defaults/main.yml deleted file mode 100644 index 5b488e7a..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/defaults/main.yml +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier copyleft-next-0.3.1 ---- -# Our sensible defaults for dev_config. You can override them by putting -# your variables in these files, the later has major precedence: -# -# ansible/extra_vars.yml - -# On your own system -sshconfig: "~/.ssh/config" -sshconfig_backup: "{{sshconfig}}.backup.kdevops.vagrant" -vagrant_dir: "../vagrant" -use_kexalgorithms: False -kexalgorithms: "" diff --git a/playbooks/roles/update_ssh_config_vagrant/python/update_ssh_config.py b/playbooks/roles/update_ssh_config_vagrant/python/update_ssh_config.py deleted file mode 120000 index c3c2d5f7..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/python/update_ssh_config.py +++ /dev/null @@ -1 +0,0 @@ -../update_ssh_config/update_ssh_config.py \ No newline at end of file diff --git a/playbooks/roles/update_ssh_config_vagrant/tasks/main.yml b/playbooks/roles/update_ssh_config_vagrant/tasks/main.yml deleted file mode 100644 index c11dfe7e..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/tasks/main.yml +++ /dev/null @@ -1,69 +0,0 @@ ---- -- name: Import optional extra_args file - include_vars: "{{ item }}" - ignore_errors: yes - with_first_found: - - files: - - "../extra_vars.yml" - - "../extra_vars.yaml" - - "../extra_vars.json" - skip: true - tags: vars - -- name: Set kexalgorithms preference - set_fact: - custom_ssh_kexalgorithms: '--kexalgorithms {{ kexalgorithms }}' - when: - - use_kexalgorithms|bool - -- name: Ignoring kexalgorithms - set_fact: - custom_ssh_kexalgorithms: '' - when: - - not use_kexalgorithms|bool - -- name: Get target hosts - shell: | - set -o pipefail - if [ -d .vagrant ]; then - if uname | grep Darwin >/dev/null; then - SED='gsed' - else - SED='sed' - fi - vagrant ssh-config | $SED '/^[[:space:]]*$/d' | grep ^Host | awk '{print $2}' | $SED ':a;N;$!ba;s/\n/,/g' - else - echo You are not in a directory with a .vagrant directory - exit 1 - fi - args: - executable: /bin/bash - chdir: "{{ vagrant_dir }}" - register: target_hosts_comma - changed_when: "target_hosts_comma.rc == 0" - -- name: Verify sshconfig directory exists - delegate_to: localhost - local_action: file path="{{ sshconfig | dirname }}" state=directory - run_once: true - -- name: Verify sshconfig file exists - delegate_to: localhost - local_action: file path="{{ sshconfig }}" state=touch - run_once: true - -- name: Set vagrant python extra args - set_fact: - update_extra_args: '--remove {{ target_hosts_comma.stdout }} --addvagranthosts {{ custom_ssh_kexalgorithms }}' - -- name: Update {{ sshconfig }} with hosts entries for vagrant - delegate_to: localhost - shell: | - set -o pipefail - {{ role_path }}/python/update_ssh_config.py {{ sshconfig }} --backup_file {{ sshconfig_backup }} {{ update_extra_args }} - args: - executable: /bin/bash - chdir: "{{ vagrant_dir }}" - register: add_entry - changed_when: "add_entry.rc == 0" - run_once: true diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/.gitignore b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/.gitignore deleted file mode 100644 index e02dcd09..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -tests/*.copy -tests/*.bk - -*.swp -__pycache__/ - diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/.travis.yml b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/.travis.yml deleted file mode 100644 index 1d14a66b..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: python -python: - - "3.6" -script: - - make test - - make flake8 -notifications: - email: - recipients: - - mcgrof@kernel.org - on_success: never - on_failure: always diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/CONTRIBUTING b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/CONTRIBUTING deleted file mode 100644 index f2889597..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/CONTRIBUTING +++ /dev/null @@ -1,49 +0,0 @@ - -This project embraces the Developer Certificate of Origin (DCO) for -contributions. This means you must agree to the following prior to submitting -patches, if you agree with this developer certificate you acknowledge this by -adding a Signed-off-by tag to your patch commit log. Every submitted patch -must have this. - -The source for the DCO: - -http://developercertificate.org/ - ------------------------------------------------------------------------ - -Developer Certificate of Origin -Version 1.1 - -Copyright (C) 2004, 2006 The Linux Foundation and its contributors. -660 York Street, Suite 102, -San Francisco, CA 94110 USA - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - - -Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -(a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -(b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -(c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -(d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/LICENSE b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/LICENSE deleted file mode 100644 index 431ea9e9..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/LICENSE +++ /dev/null @@ -1,239 +0,0 @@ -Valid-License-Identifier: copyleft-next-0.3.1 -SPDX-URL: https://spdx.org/licenses/copyleft-next-0.3.1 -Usage-Guide: - This license can be used in code, it has been found to be GPLv2 compatible - by attorneys at Redhat and SUSE, however to err on the side of caution, - if used on Linux it's best to only use it together with a GPL2 compatible - license using "OR". You do not have to do this for this project, kdevops, - as this project is licensed under the copyleft-next-0.3.1 license. - To use the copyleft-next-0.3.1 license on Linux put the following SPDX - tag/value pair into a comment according to the placement guidelines in the - licensing rules documentation: - SPDX-License-Identifier: GPL-2.0 OR copyleft-next-0.3.1 - SPDX-License-Identifier: GPL-2.0-only OR copyleft-next 0.3.1 - SPDX-License-Identifier: GPL-2.0+ OR copyleft-next-0.3.1 - SPDX-License-Identifier: GPL-2.0-or-later OR copyleft-next-0.3.1 -License-Text: - -======================================================================= - - copyleft-next 0.3.1 ("this License") - Release date: 2016-04-29 - -1. License Grants; No Trademark License - - Subject to the terms of this License, I grant You: - - a) A non-exclusive, worldwide, perpetual, royalty-free, irrevocable - copyright license, to reproduce, Distribute, prepare derivative works - of, publicly perform and publicly display My Work. - - b) A non-exclusive, worldwide, perpetual, royalty-free, irrevocable - patent license under Licensed Patents to make, have made, use, sell, - offer for sale, and import Covered Works. - - This License does not grant any rights in My name, trademarks, service - marks, or logos. - -2. Distribution: General Conditions - - You may Distribute Covered Works, provided that You (i) inform - recipients how they can obtain a copy of this License; (ii) satisfy the - applicable conditions of sections 3 through 6; and (iii) preserve all - Legal Notices contained in My Work (to the extent they remain - pertinent). "Legal Notices" means copyright notices, license notices, - license texts, and author attributions, but does not include logos, - other graphical images, trademarks or trademark legends. - -3. Conditions for Distributing Derived Works; Outbound GPL Compatibility - - If You Distribute a Derived Work, You must license the entire Derived - Work as a whole under this License, with prominent notice of such - licensing. This condition may not be avoided through such means as - separate Distribution of portions of the Derived Work. - - If the Derived Work includes material licensed under the GPL, You may - instead license the Derived Work under the GPL. - -4. Condition Against Further Restrictions; Inbound License Compatibility - - When Distributing a Covered Work, You may not impose further - restrictions on the exercise of rights in the Covered Work granted under - this License. This condition is not excused merely because such - restrictions result from Your compliance with conditions or obligations - extrinsic to this License (such as a court order or an agreement with a - third party). - - However, You may Distribute a Covered Work incorporating material - governed by a license that is both OSI-Approved and FSF-Free as of the - release date of this License, provided that compliance with such - other license would not conflict with any conditions stated in other - sections of this License. - -5. Conditions for Distributing Object Code - - You may Distribute an Object Code form of a Covered Work, provided that - you accompany the Object Code with a URL through which the Corresponding - Source is made available, at no charge, by some standard or customary - means of providing network access to source code. - - If you Distribute the Object Code in a physical product or tangible - storage medium ("Product"), the Corresponding Source must be available - through such URL for two years from the date of Your most recent - Distribution of the Object Code in the Product. However, if the Product - itself contains or is accompanied by the Corresponding Source (made - available in a customarily accessible manner), You need not also comply - with the first paragraph of this section. - - Each direct and indirect recipient of the Covered Work from You is an - intended third-party beneficiary of this License solely as to this - section 5, with the right to enforce its terms. - -6. Symmetrical Licensing Condition for Upstream Contributions - - If You Distribute a work to Me specifically for inclusion in or - modification of a Covered Work (a "Patch"), and no explicit licensing - terms apply to the Patch, You license the Patch under this License, to - the extent of Your copyright in the Patch. This condition does not - negate the other conditions of this License, if applicable to the Patch. - -7. Nullification of Copyleft/Proprietary Dual Licensing - - If I offer to license, for a fee, a Covered Work under terms other than - a license that is OSI-Approved or FSF-Free as of the release date of this - License or a numbered version of copyleft-next released by the - Copyleft-Next Project, then the license I grant You under section 1 is no - longer subject to the conditions in sections 3 through 5. - -8. Copyleft Sunset - - The conditions in sections 3 through 5 no longer apply once fifteen - years have elapsed from the date of My first Distribution of My Work - under this License. - -9. Pass-Through - - When You Distribute a Covered Work, the recipient automatically receives - a license to My Work from Me, subject to the terms of this License. - -10. Termination - - Your license grants under section 1 are automatically terminated if You - - a) fail to comply with the conditions of this License, unless You cure - such noncompliance within thirty days after becoming aware of it, or - - b) initiate a patent infringement litigation claim (excluding - declaratory judgment actions, counterclaims, and cross-claims) - alleging that any part of My Work directly or indirectly infringes - any patent. - - Termination of Your license grants extends to all copies of Covered - Works You subsequently obtain. Termination does not terminate the - rights of those who have received copies or rights from You subject to - this License. - - To the extent permission to make copies of a Covered Work is necessary - merely for running it, such permission is not terminable. - -11. Later License Versions - - The Copyleft-Next Project may release new versions of copyleft-next, - designated by a distinguishing version number ("Later Versions"). - Unless I explicitly remove the option of Distributing Covered Works - under Later Versions, You may Distribute Covered Works under any Later - Version. - -** 12. No Warranty ** -** ** -** My Work is provided "as-is", without warranty. You bear the risk ** -** of using it. To the extent permitted by applicable law, each ** -** Distributor of My Work excludes the implied warranties of title, ** -** merchantability, fitness for a particular purpose and ** -** non-infringement. ** - -** 13. Limitation of Liability ** -** ** -** To the extent permitted by applicable law, in no event will any ** -** Distributor of My Work be liable to You for any damages ** -** whatsoever, whether direct, indirect, special, incidental, or ** -** consequential damages, whether arising under contract, tort ** -** (including negligence), or otherwise, even where the Distributor ** -** knew or should have known about the possibility of such damages. ** - -14. Severability - - The invalidity or unenforceability of any provision of this License - does not affect the validity or enforceability of the remainder of - this License. Such provision is to be reformed to the minimum extent - necessary to make it valid and enforceable. - -15. Definitions - - "Copyleft-Next Project" means the project that maintains the source - code repository at - as of the release date of this License. - - "Corresponding Source" of a Covered Work in Object Code form means (i) - the Source Code form of the Covered Work; (ii) all scripts, - instructions and similar information that are reasonably necessary for - a skilled developer to generate such Object Code from the Source Code - provided under (i); and (iii) a list clearly identifying all Separate - Works (other than those provided in compliance with (ii)) that were - specifically used in building and (if applicable) installing the - Covered Work (for example, a specified proprietary compiler including - its version number). Corresponding Source must be machine-readable. - - "Covered Work" means My Work or a Derived Work. - - "Derived Work" means a work of authorship that copies from, modifies, - adapts, is based on, is a derivative work of, transforms, translates or - contains all or part of My Work, such that copyright permission is - required. The following are not Derived Works: (i) Mere Aggregation; - (ii) a mere reproduction of My Work; and (iii) if My Work fails to - explicitly state an expectation otherwise, a work that merely makes - reference to My Work. - - "Distribute" means to distribute, transfer or make a copy available to - someone else, such that copyright permission is required. - - "Distributor" means Me and anyone else who Distributes a Covered Work. - - "FSF-Free" means classified as 'free' by the Free Software Foundation. - - "GPL" means a version of the GNU General Public License or the GNU - Affero General Public License. - - "I"/"Me"/"My" refers to the individual or legal entity that places My - Work under this License. "You"/"Your" refers to the individual or legal - entity exercising rights in My Work under this License. A legal entity - includes each entity that controls, is controlled by, or is under - common control with such legal entity. "Control" means (a) the power to - direct the actions of such legal entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent of the - outstanding shares or beneficial ownership of such legal entity. - - "Licensed Patents" means all patent claims licensable royalty-free by - Me, now or in the future, that are necessarily infringed by making, - using, or selling My Work, and excludes claims that would be infringed - only as a consequence of further modification of My Work. - - "Mere Aggregation" means an aggregation of a Covered Work with a - Separate Work. - - "My Work" means the particular work of authorship I license to You - under this License. - - "Object Code" means any form of a work that is not Source Code. - - "OSI-Approved" means approved as 'Open Source' by the Open Source - Initiative. - - "Separate Work" means a work that is separate from and independent of a - particular Covered Work and is not by its nature an extension or - enhancement of the Covered Work, and/or a runtime library, standard - library or similar component that is used to generate an Object Code - form of a Covered Work. - - "Source Code" means the preferred form of a work for making - modifications to it. diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/Makefile b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/Makefile deleted file mode 100644 index 5dbca28d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -all: python-tests -PHONY += all - -python-tests: test flake8 -PHONY += python-tests - -test: - python3 -m unittest discover -v -PHONY += test - -flake8: - flake8 --statistics -PHONY += flake8 - -.PHONY: $(PHONY) diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/README.md b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/README.md deleted file mode 100644 index 6b540c8a..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/README.md +++ /dev/null @@ -1,159 +0,0 @@ -# Project home - -This project's home page is: - - * https://github.com/linux-kdevops/update_ssh_config/ - -This code lives under the linux-kdevops organization as code changes -can be made to it there by any member of the linux-kdevops organization. - -# Sharing this code between vagrant and terraform - -The main user of this project is [kdevops](https://github.com/linux-kdevops/kdevops) -and it uses this code today for vagranta nd terraform bringup methods. When -using terraform, as part of the last part of bring up it calls ansible -against the localhost with an ansible role [update_ssh_config_vagrant](https://github.com/linux-kdevops/kdevops/tree/master/playbooks/roles/update_ssh_config_vagrant). - -Kdevop's terraform provisioning uses this code by publishing an terraform -module and referring to it on each cloud specific provider: - - * https://registry.terraform.io/modules/linux-kdevops/add-host-ssh-config/kdevops/latest - -kdevops uses the code in this tree as a git subtree. Delta for the code -in this directory can be queued up in kdevops, but a developer should at some -point in time push the code also back up to the master tree. This can be done -with something like this: - -```bash -git subtree push --prefix=playbooks/roles/update_ssh_config_vagrant/update_ssh_config update_ssh_config master -``` - -This will only push the code changes under the directory `playbooks/roles/update_ssh_config_vagrant/update_ssh_config` -back to the update_ssh_config repository. In order for a new terraform -module to be published a git tag is required to be tagged on the -`update_ssh_config` git tree. Terraform will do sanity checks and publish -a new module once that is available. Then each terraform provider file -must be updated to ensure they use the latest avilable version of the module. - -# update_ssh_config - -This Python script you update your ssh configuration file, typically -` ~/.ssh/config` programatically. It was originally designed to extend -vagrant so that it would update your user's ssh configuration, and later -terraform support was added. The same python script however is shared -between both projects: - - * [update_ssh_config_vagrant](https://github.com/linux-kdevops/update_ssh_config_vagrant) - ansible role for vagrant to update your ssh configuration - * [terraform-kdevops-add-host-ssh-config](https://github.com/linux-kdevops/terraform-kdevops-add-host-ssh-config) - terraform module to update you ssh configuration - -This git tree aims at providing a mechanism to allow both projects to share -the same python script. They bring in this code using a git subtree. - -## Usage - -Below are example command line uses: - -## Adding hosts to the top - -Note that as noted on the reported [issue#3](https://github.com/mcgrof/kdevops/issues/3) -[ssh_config(5)](https://man7.org/linux/man-pages/man5/ssh_config.5.html) -man page states that we should add entries at the top: - -``` -Since the first obtained value for each parameter is used, more host-specific -declarations should be given near the beginning of the file, and general -defaults at the end. -``` - -This project adheres to this best practice. - -## Tests - -To run tests: - -```bash -make test -make flake8 -``` - -### The vagrant use case - -This will remove the hosts entries for two hosts, kdevops and kdevops-dev, -and then it adds the hosts using the output from `vagrant ssh-config`. The -output from the command `vagrant ssh-config` is processed by the script, -to allow further extensions. - -A backup file is used, just for safe measures. - -``` -update_ssh_config.py \ - ~/.ssh/config \ - --backup_file ~/.ssh/config.backup.kdevops.vagrant \ - --remove kdevops,kdevops-dev \ - --addvagranthosts -``` - -Contrary to the terraform use case we don't perform two operations, and so -we only use one backup file. This is tested under the test case: - - * `test_0009_add_hosts_vagrant_emulate_top()` - -## The terraform use case - -Terraform does the same, both removal and addition in one shot, but it passes -the parameters on the command line: - -``` -update_ssh_config.py \ - --addhost kdevops,kdevops-dev \ - --hostname 51.179.84.243,52.195.142.18 \ - --username mcgrof \ - --port 22 \ - --identity \ - ~/.ssh/kdevops_terraform \ - --addstrict \ - --backup_file ~/.ssh/config.backup.kdevops.terraform \ - ~/.ssh/config -``` - -This is tested under test case: - - * `test_0008_add_remove_hosts_one_shot_top()` - -## Custom KexAlgorithms - -Certain old hosts require a custom KexAlgorithms entry to be added. -To add that use the `--kexalgorithms` parameter. This is tested -with the following test test cases: - - * `0010_add_hosts_kexalgorithms_vagrant_emulate_top()`: to mimic the use - case if used by vagrant - * `0011_add_remove_hosts_two_separate_ops_kexalgorithms_top()`: to mimic the - use case if used by terraform - -## Rationale for using Python3 - -We explicitly rely on python3 because our current use case is vagrant and -terraform users, and that software should be used on recent distributions, -hopefully rolling distrubutions which get updated more often than not. Because -modern distributions are expected to be used as your command and control, it -is a safe assumption you must have python3 available. - -Also, some distributions, such as Debian testing as of September 2020, no longer -have a `/usr/bin/python` symlink, and the -[Debian Python Policy](https://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html#s-interpreter) -specifically requests that scripts do not use `/usr/bin/env`, do not use -`/usr/bin/python` and instead use the exact version desired. - -If you'd like to add Python2 support feel free to add a python2 version file, -maybe `update_ssh_config2.py` and just have your project symlink to it. The -way vagrant and terraform will use this script is to symlink to the Python3 -version. - -### Author - -[Luis Chamberlain](https://www.do-not-panic.com) - -### License - -copyleft-next-0.3.1 diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/test_update_ssh_config.py b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/test_update_ssh_config.py deleted file mode 100755 index f28d9cba..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/test_update_ssh_config.py +++ /dev/null @@ -1,417 +0,0 @@ -#!/usr/bin/python3 -# SPDX-License-Identifier: copyleft-next-0.3.1 - -import unittest -import re -from filecmp import cmp -import inspect -from os import listdir, remove, path -from shutil import copyfile -from update_ssh_config import parse_args, run_args - -""" -Unit tests for update_ssh_config.py -""" - - -def get_test_files(function_name): - test_names = [] - target_sshconfig = 'tests/' + re.sub('^test_', '', function_name) - test_names.append(target_sshconfig) - target_sshconfig_orig = target_sshconfig + '.orig' - test_names.append(target_sshconfig_orig) - target_sshconfig_copy = target_sshconfig + '.copy' - test_names.append(target_sshconfig_copy) - target_sshconfig_res = target_sshconfig + '.res' - test_names.append(target_sshconfig_res) - target_sshconfig_bk = target_sshconfig + '.bk' - test_names.append(target_sshconfig_bk) - return test_names - - -class TestUpdateSshConfig(unittest.TestCase): - def test_0001_remove_hosts_top(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args([target_sshconfig_copy, - '--backup_file', - target_sshconfig_bk, - '--remove', - 'kdevops,kdevops-dev']) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def test_0002_remove_hosts_middle(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args([target_sshconfig_copy, - '--backup_file', - target_sshconfig_bk, - '--remove', - 'kdevops,kdevops-dev']) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def test_0003_remove_hosts_bottom(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args([target_sshconfig_copy, - '--backup_file', - target_sshconfig_bk, - '--remove', - 'kdevops,kdevops-dev']) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def test_0004_remove_hosts_missing(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args([target_sshconfig_copy, - '--backup_file', - target_sshconfig_bk, - '--remove', - 'kdevops,kdevops-dev']) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def test_0005_remove_hosts_similar(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args([target_sshconfig_copy, - '--backup_file', - target_sshconfig_bk, - '--remove', - 'kdevops,kdevops-dev']) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def test_0006_add_hosts_manual(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args(['--addhost', - 'kdevops,kdevops-dev', - '--backup_file', - target_sshconfig_bk, - '--username', - 'alpha', - '--hostname', - '51.179.89.243,52.195.142.19', - '--port', - '25', - '--identity', - '~alpha/.ssh/go', - '--addstrict', - target_sshconfig_copy]) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def test_0007_add_remove_hosts_two_separate_ops_top(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig = tests_names[0] - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - - target_sshconfig_res_remove = target_sshconfig + '.remove.res' - target_sshconfig_res_add = target_sshconfig + '.add.res' - - target_sshconfig_bk_remove = target_sshconfig + '.remove.bk' - target_sshconfig_bk_add = target_sshconfig + '.add.bk' - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args(['--remove', - 'kdevops,kdevops-dev', - '--backup_file', - target_sshconfig_bk_remove, - '--username', - 'alpha', - '--hostname', - '51.179.89.243,52.195.142.19', - '--port', - '25', - '--identity', - '~alpha/.ssh/go', - '--addstrict', - target_sshconfig_copy]) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk_remove, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res_remove, shallow=False)) - - args = parse_args(['--addhost', - 'kdevops,kdevops-dev', - '--backup_file', - target_sshconfig_bk_add, - '--username', - 'alpha', - '--hostname', - '51.179.89.243,52.195.142.19', - '--port', - '25', - '--identity', - '~alpha/.ssh/go', - '--addstrict', - target_sshconfig_copy]) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk_add, - target_sshconfig_res_remove, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res_add, shallow=False)) - - def test_0008_add_remove_hosts_one_shot_top(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args(['--remove', - 'kdevops,kdevops-dev', - '--addhost', - 'kdevops,kdevops-dev', - '--backup_file', - target_sshconfig_bk, - '--username', - 'alpha', - '--hostname', - '51.179.89.243,52.195.142.19', - '--port', - '25', - '--identity', - '~alpha/.ssh/go', - '--addstrict', - target_sshconfig_copy]) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def test_0009_add_hosts_vagrant_emulate_top(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig = tests_names[0] - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - target_sshconfig_vagrant_input = target_sshconfig + '.emulate_vagrant' - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args([target_sshconfig_copy, - '--backup_file', - target_sshconfig_bk, - '--remove', - 'kdevops,kdevops-dev', - '--addvagranthosts', - '--emulatevagrantinput', - target_sshconfig_vagrant_input]) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def test_0010_add_hosts_kexalgorithms_vagrant_emulate_top(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig = tests_names[0] - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - target_sshconfig_vagrant_input = target_sshconfig + '.emulate_vagrant' - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args([target_sshconfig_copy, - '--backup_file', - target_sshconfig_bk, - '--remove', - 'kdevops,kdevops-dev', - '--addvagranthosts', - '--kexalgorithms', - 'diffie-hellman-group-exchange-sha1,' + - 'diffie-hellman-group14-sha1,' + - 'diffie-hellman-group1-sha1', - '--emulatevagrantinput', - target_sshconfig_vagrant_input]) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def test_0011_add_remove_hosts_two_separate_ops_kexalgorithms_top(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig = tests_names[0] - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - - target_sshconfig_res_remove = target_sshconfig + '.remove.res' - target_sshconfig_res_add = target_sshconfig + '.add.res' - - target_sshconfig_bk_remove = target_sshconfig + '.remove.bk' - target_sshconfig_bk_add = target_sshconfig + '.add.bk' - - copyfile(target_sshconfig_orig, target_sshconfig_copy) - - args = parse_args(['--remove', - 'kdevops,kdevops-dev', - '--backup_file', - target_sshconfig_bk_remove, - '--username', - 'alpha', - '--hostname', - '51.179.89.243,52.195.142.19', - '--port', - '25', - '--identity', - '~alpha/.ssh/go', - '--kexalgorithms', - 'diffie-hellman-group-exchange-sha1,' + - 'diffie-hellman-group14-sha1,' + - 'diffie-hellman-group1-sha1', - '--addstrict', - target_sshconfig_copy]) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk_remove, - target_sshconfig_orig, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res_remove, shallow=False)) - - args = parse_args(['--addhost', - 'kdevops,kdevops-dev', - '--backup_file', - target_sshconfig_bk_add, - '--username', - 'alpha', - '--hostname', - '51.179.89.243,52.195.142.19', - '--port', - '25', - '--identity', - '~alpha/.ssh/go', - '--kexalgorithms', - 'diffie-hellman-group-exchange-sha1,' + - 'diffie-hellman-group14-sha1,' + - 'diffie-hellman-group1-sha1', - '--addstrict', - target_sshconfig_copy]) - run_args(args) - self.assertTrue(cmp(target_sshconfig_bk_add, - target_sshconfig_res_remove, shallow=False)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res_add, shallow=False)) - - def test_0012_add_remove_hosts_empty_file(self): - this_function_name = inspect.stack()[0][3] - tests_names = get_test_files(this_function_name) - target_sshconfig_orig = tests_names[1] - target_sshconfig_copy = tests_names[2] - target_sshconfig_res = tests_names[3] - target_sshconfig_bk = tests_names[4] - - args = parse_args(['--remove', - 'kdevops,kdevops-dev', - '--addhost', - 'kdevops,kdevops-dev', - '--backup_file', - target_sshconfig_bk, - '--username', - 'alpha', - '--hostname', - '51.179.89.243,52.195.142.19', - '--port', - '25', - '--identity', - '~alpha/.ssh/go', - '--addstrict', - target_sshconfig_copy]) - self.assertTrue(not path.exists(target_sshconfig_orig)) - self.assertTrue(not path.exists(target_sshconfig_copy)) - run_args(args) - self.assertTrue(not path.exists(target_sshconfig_orig)) - self.assertTrue(not path.exists(target_sshconfig_bk)) - self.assertTrue(path.exists(target_sshconfig_copy)) - self.assertTrue(cmp(target_sshconfig_copy, - target_sshconfig_res, shallow=False)) - - def tearDown(self): - files = listdir("tests") - for testfile in files: - if testfile.endswith(".copy") or testfile.endswith(".bk"): - remove(path.join("tests", testfile)) - - -if __name__ == '__main__': - unittest.main(verbosity=2) diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0001_remove_hosts_top.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0001_remove_hosts_top.orig deleted file mode 100644 index d519e88c..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0001_remove_hosts_top.orig +++ /dev/null @@ -1,53 +0,0 @@ -Host kdevops - HostName 192.168.31.12 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev - HostName 192.168.31.13 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops-dev/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0001_remove_hosts_top.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0001_remove_hosts_top.res deleted file mode 100644 index b13f939d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0001_remove_hosts_top.res +++ /dev/null @@ -1,33 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0002_remove_hosts_middle.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0002_remove_hosts_middle.orig deleted file mode 100644 index dc3dfd4f..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0002_remove_hosts_middle.orig +++ /dev/null @@ -1,53 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host kdevops - HostName 192.168.31.12 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev - HostName 192.168.31.13 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops-dev/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0002_remove_hosts_middle.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0002_remove_hosts_middle.res deleted file mode 100644 index b13f939d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0002_remove_hosts_middle.res +++ /dev/null @@ -1,33 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0003_remove_hosts_bottom.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0003_remove_hosts_bottom.orig deleted file mode 100644 index e115da8d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0003_remove_hosts_bottom.orig +++ /dev/null @@ -1,53 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host kdevops - HostName 192.168.31.12 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev - HostName 192.168.31.13 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops-dev/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0003_remove_hosts_bottom.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0003_remove_hosts_bottom.res deleted file mode 100644 index b13f939d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0003_remove_hosts_bottom.res +++ /dev/null @@ -1,33 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0004_remove_hosts_missing.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0004_remove_hosts_missing.orig deleted file mode 100644 index b13f939d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0004_remove_hosts_missing.orig +++ /dev/null @@ -1,33 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0004_remove_hosts_missing.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0004_remove_hosts_missing.res deleted file mode 100644 index b13f939d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0004_remove_hosts_missing.res +++ /dev/null @@ -1,33 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0005_remove_hosts_similar.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0005_remove_hosts_similar.orig deleted file mode 100644 index 17896ac4..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0005_remove_hosts_similar.orig +++ /dev/null @@ -1,53 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host kdevopss - HostName 192.168.31.12 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-devs - HostName 192.168.31.13 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops-dev/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0005_remove_hosts_similar.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0005_remove_hosts_similar.res deleted file mode 100644 index 17896ac4..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0005_remove_hosts_similar.res +++ /dev/null @@ -1,53 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host kdevopss - HostName 192.168.31.12 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-devs - HostName 192.168.31.13 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops-dev/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0006_add_hosts_manual.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0006_add_hosts_manual.orig deleted file mode 100644 index b13f939d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0006_add_hosts_manual.orig +++ /dev/null @@ -1,33 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0006_add_hosts_manual.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0006_add_hosts_manual.res deleted file mode 100644 index e65abcc3..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0006_add_hosts_manual.res +++ /dev/null @@ -1,53 +0,0 @@ -Host kdevops 51.179.89.243 - HostName 51.179.89.243 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev 52.195.142.19 - HostName 52.195.142.19 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.add.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.add.res deleted file mode 100644 index e65abcc3..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.add.res +++ /dev/null @@ -1,53 +0,0 @@ -Host kdevops 51.179.89.243 - HostName 51.179.89.243 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev 52.195.142.19 - HostName 52.195.142.19 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.orig deleted file mode 100644 index c497d405..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.orig +++ /dev/null @@ -1,53 +0,0 @@ -Host kdevops - HostName 192.168.3.9 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev - HostName 192.168.3.10 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops-dev/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.remove.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.remove.res deleted file mode 100644 index b13f939d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0007_add_remove_hosts_two_separate_ops_top.remove.res +++ /dev/null @@ -1,33 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0008_add_remove_hosts_one_shot_top.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0008_add_remove_hosts_one_shot_top.orig deleted file mode 120000 index fec797de..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0008_add_remove_hosts_one_shot_top.orig +++ /dev/null @@ -1 +0,0 @@ -0007_add_remove_hosts_two_separate_ops_top.orig \ No newline at end of file diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0008_add_remove_hosts_one_shot_top.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0008_add_remove_hosts_one_shot_top.res deleted file mode 120000 index 533331a8..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0008_add_remove_hosts_one_shot_top.res +++ /dev/null @@ -1 +0,0 @@ -0007_add_remove_hosts_two_separate_ops_top.add.res \ No newline at end of file diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.emulate_vagrant b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.emulate_vagrant deleted file mode 100644 index f9d831eb..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.emulate_vagrant +++ /dev/null @@ -1,20 +0,0 @@ -Host kdevops - HostName 51.179.89.243 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev - HostName 52.195.142.19 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.orig deleted file mode 120000 index fec797de..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.orig +++ /dev/null @@ -1 +0,0 @@ -0007_add_remove_hosts_two_separate_ops_top.orig \ No newline at end of file diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.res deleted file mode 100644 index 26401701..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0009_add_hosts_vagrant_emulate_top.res +++ /dev/null @@ -1,53 +0,0 @@ -Host kdevops-dev 52.195.142.19 - HostName 52.195.142.19 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops 51.179.89.243 - HostName 51.179.89.243 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.emulate_vagrant b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.emulate_vagrant deleted file mode 100644 index f9d831eb..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.emulate_vagrant +++ /dev/null @@ -1,20 +0,0 @@ -Host kdevops - HostName 51.179.89.243 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev - HostName 52.195.142.19 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.orig deleted file mode 100644 index c497d405..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.orig +++ /dev/null @@ -1,53 +0,0 @@ -Host kdevops - HostName 192.168.3.9 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev - HostName 192.168.3.10 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops-dev/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.res deleted file mode 100644 index 2c315e68..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0010_add_hosts_kexalgorithms_vagrant_emulate_top.res +++ /dev/null @@ -1,55 +0,0 @@ -Host kdevops-dev 52.195.142.19 - HostName 52.195.142.19 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops 51.179.89.243 - HostName 51.179.89.243 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.add.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.add.res deleted file mode 100644 index 6699c65f..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.add.res +++ /dev/null @@ -1,55 +0,0 @@ -Host kdevops 51.179.89.243 - HostName 51.179.89.243 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev 52.195.142.19 - HostName 52.195.142.19 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.orig b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.orig deleted file mode 100644 index c497d405..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.orig +++ /dev/null @@ -1,53 +0,0 @@ -Host kdevops - HostName 192.168.3.9 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev - HostName 192.168.3.10 - User vagrant - Port 22 - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/kdevops-dev/libvirt/private_key - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.remove.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.remove.res deleted file mode 100644 index b13f939d..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0011_add_remove_hosts_two_separate_ops_kexalgorithms_top.remove.res +++ /dev/null @@ -1,33 +0,0 @@ -Host * - ServerAliveInterval 60 - ServerAliveCountMax 2 -Host apples - User mcgrof - Port 22 - HostName 192.168.1.10 - IdentityFile ~/.ssh/apples -Host apples-pub - User mcgrof - Port 6913 - HostName 71.72.31.95 - IdentityFile ~/.ssh/apples -Host starwars - HostName 192.168.2.92 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL -Host starwars-dev - HostName 192.168.2.78 - User vagrant - Port 22 - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentityFile /home/mcgrof/devel/kdevops/vagrant/.vagrant/machines/starwars-dev/libvirt/private_key - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0012_add_remove_hosts_empty_file.res b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0012_add_remove_hosts_empty_file.res deleted file mode 100644 index 311eff20..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/tests/0012_add_remove_hosts_empty_file.res +++ /dev/null @@ -1,20 +0,0 @@ -Host kdevops 51.179.89.243 - HostName 51.179.89.243 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL -Host kdevops-dev 52.195.142.19 - HostName 52.195.142.19 - User alpha - Port 25 - IdentityFile ~alpha/.ssh/go - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - PasswordAuthentication no - IdentitiesOnly yes - LogLevel FATAL diff --git a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/update_ssh_config.py b/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/update_ssh_config.py deleted file mode 100755 index feac31d2..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/update_ssh_config/update_ssh_config.py +++ /dev/null @@ -1,325 +0,0 @@ -#!/usr/bin/python3 -# SPDX-License-Identifier: copyleft-next-0.3.1 - -import argparse -import sys -import os -import re -import subprocess -from shutil import copyfile - - -class VagrantError(Exception): - pass - - -class ExecutionError(VagrantError): - def __init__(self, errcode): - self.error_code = errcode - - -def _check(process): - if process.returncode != 0: - raise ExecutionError(process.returncode) - - -def key_val(line): - no_comment = line.split("#")[0] - return [x.strip() for x in re.split(r"\s+", no_comment.strip(), 1)] - - -def remove_hosts(args): - hosts = args.remove.split(",") - - f = open(args.ssh_config, "r") - lines = f.read().splitlines() - f.close() - new_lines = list() - rm_this_host = False - for line in lines: - kv = key_val(line) - if len(kv) > 1: - key, value = kv - if key.lower() == "host": - if value in hosts: - rm_this_host = True - continue - else: - rm_this_host = False - new_lines.append(line) - else: - if not rm_this_host: - new_lines.append(line) - else: - new_lines.append(line) - - f = open(args.ssh_config, "w") - f.write("\n".join([x for x in new_lines]) + "\n") - f.close() - - -def add_vagrant_hosts(args): - lines = None - if args.emulatevagrantinput: - f = open(args.emulatevagrantinput, "r") - lines = f.read().splitlines() - f.close() - else: - process = subprocess.Popen(['vagrant', 'ssh-config'], - stdout=subprocess.PIPE, - close_fds=True, universal_newlines=True) - stdout = process.communicate()[0] - process.wait() - _check(process) - lines = stdout.splitlines() - - addhost = "" - hostname = "" - username = "" - port = "" - identity = "" - kexalgorithms = None - - # All vagrant hosts are strict, which allows us to skip checking all of - # the parameters which define this. - addstrict = True - - last_host_added = "" - newhost = None - - if args.kexalgorithms and args.kexalgorithms is not None: - kexalgorithms = args.kexalgorithms - - for line in lines: - if not line: - continue - kv = key_val(line) - if len(kv) > 1: - key, value = kv - if key.lower() == "host": - if addhost != "": - newhost = SshHost(args.ssh_config, addhost, hostname, - username, port, identity, addstrict, - kexalgorithms) - newhost.call_add_host() - last_host_added = addhost - addhost = value - hostname = "" - username = "" - port = "" - identity = "" - addstrict = True - if key.lower() == "hostname": - hostname = value - elif key.lower() == "user": - username = value - elif key.lower() == "port": - port = value - elif key.lower() == "identityfile": - identity = value - - if last_host_added != addhost: - newhost = SshHost(args.ssh_config, addhost, hostname, username, port, - identity, addstrict, kexalgorithms) - newhost.call_add_host() - - -# We extend the SshHost with the variables which we add to our ArgumentParser -# and which we use on this function so that we can pass to this function either -# an ArgumentParser object or one of our SshHost objects -def add_host(args): - hosts = args.addhost.split(",") - new_lines = list() - hostnames = list() - ports = list() - count = 0 - - if args.hostname: - hostnames = args.hostname.split(",") - - if len(hosts) > 1 and len(hostnames) > 1: - if len(hosts) != len(hostnames): - sys.stdout.write("Number of shorthosts must match number of " + - "hostnames\n") - sys.exit(1) - - if args.port: - ports = args.port.split(",") - - if len(hosts) > 1 and len(ports) > 1: - if len(hosts) != len(ports): - sys.stdout.write("Number of shorthosts must match number of " + - "ports\n") - sys.exit(1) - - for host in hosts: - host_port = host.split(":") - hostname = "" - port = "" - if len(host_port) > 1: - host, port = host_port - if port == "" and args.port: - if len(ports) > 1: - port = ports[count] - else: - port = args.port - if len(hostnames) > 1: - hostname = hostnames[count] - elif args.hostname: - hostname = args.hostname - if hostname: - new_lines.append("Host %s %s\n" % (host, hostname)) - new_lines.append("\tHostName %s\n" % (hostname)) - else: - new_lines.append("Host %s\n" % (host)) - if port == "" and args.port: - port = args.port - if args.username: - new_lines.append("\tUser %s\n" % (args.username)) - if port != "": - new_lines.append("\tPort %s\n" % (port)) - if args.identity: - new_lines.append("\tIdentityFile %s\n" % (args.identity)) - if args.kexalgorithms and args.kexalgorithms is not None: - new_lines.append("\tKexAlgorithms %s\n" % (args.kexalgorithms)) - if args.addstrict: - new_lines.append("\tUserKnownHostsFile /dev/null\n") - new_lines.append("\tStrictHostKeyChecking no\n") - new_lines.append("\tPasswordAuthentication no\n") - new_lines.append("\tIdentitiesOnly yes\n") - new_lines.append("\tLogLevel FATAL\n") - count = count + 1 - - data = "" - all_data = None - if os.path.exists(args.ssh_config): - f = open(args.ssh_config, "r") - data = f.read() - f.close() - - new_data = "".join([x for x in new_lines]) - all_data = new_data + data - - f = open(args.ssh_config, 'w') - f.write(all_data) - f.close() - - -class SshHost: - def __init__(self, ssh_config, name, hostname, username, port, identity, - strict, kexalgorithms): - self.ssh_config = ssh_config - self.addhost = name - self.hostname = hostname - self.username = username - self.port = port - self.identity = identity - self.addstrict = strict - self.kexalgorithms = kexalgorithms - - def call_add_host(self): - add_host(self) - - def call_remove_hosts(self): - remove_hosts(self) - - -def parse_args(args): - parser = argparse.ArgumentParser() - parser.add_argument('ssh_config', help='ssh configuration file to process') - parser.add_argument('--addhost', - help='The host shortcut name you are adding. This ' + - 'can be a comma separated set of hosts and each host' + - 'can have a port specified with a colon, if set ' + - 'it will override override the port set by --port. ' + - 'will let you set a default port if non specified ' + - 'but allow you to override ports per host. We refer ' + - 'this entry as the shorthost.') - parser.add_argument('--addvagranthosts', - const=True, default=False, action="store_const", - help='Use this if you are want to add or augment ' + - 'the entries found from the output of the command ' + - 'vagrant ssh-config. You would typically use this ' + - 'if you are working with vagrant, and are in the ' + - 'vagrant directory. Only a few parameters are ' + - 'supported when augmenting the information ' + - 'installed per host, those are entries which ' + - 'vagrant does not add which you may need, for ' + - 'instance on older hosts') - parser.add_argument('--emulatevagrantinput', - help='Used for testing purposes only,' + - 'where we do not want to run vagrant ssh-config.' + - 'The parameter passed is an input file which ' + - 'emulates the command') - parser.add_argument('--hostname', - help='Used only on addition, the hostname to use ' + - 'for this entry. If the shorhost specified was a ' + - 'comma separated list of hosts, then this can also ' + - 'be a comma separated list, in which case each ' + - 'shorthost index represents the hostname for that ' + - 'shorthost, and the number of both shorthosts and ' + - 'hostname must match.') - parser.add_argument('--port', - help='Used only on addition, the port to use, ' + - 'by default none is specified') - parser.add_argument('--username', - help='Used only on addition, the username to use, ' + - 'default is none, so ssh will assumes your ' + - 'localhost username') - parser.add_argument('--identity', - help='Used only on addition, the host key to ' + - 'use, the default is empty and so no file is provided') - parser.add_argument('--kexalgorithms', - help='Use this if you have a custom KexAlgorithms ' + - 'entry you want to add for the host entries. ' + - 'This is typically useful for older hosts.') - parser.add_argument('--addstrict', - const=True, default=False, action="store_const", - help='Used only on addition, if set some extra ' + - 'sensible strict defaults will be added to the host ' + - 'entry, disabled by default') - parser.add_argument('--remove', - help='Comma separated list of host entries to remove') - parser.add_argument('--backup_file', - help='Use this file as the backup') - parser.add_argument('--nobackup', - const=True, default=False, action="store_const", - help='Do not use a backup file') - return parser.parse_args(args) - - -def run_args(args): - skip_remove_and_backup = False - if not args.remove and not args.addhost: - print("Must specify addition or removal request") - sys.exit(0) - - if not os.path.isfile(args.ssh_config): - args.nobackup = True - skip_remove_and_backup = True - - backup_file = args.ssh_config + '.kdevops.bk' - if args.backup_file: - backup_file = args.backup_file - if args.nobackup: - backup_file = None - - if not skip_remove_and_backup and backup_file: - copyfile(args.ssh_config, backup_file) - - if not skip_remove_and_backup and args.remove: - remove_hosts(args) - - if args.addvagranthosts: - add_vagrant_hosts(args) - elif args.addhost: - add_host(args) - - -def main(): - args = parse_args(sys.argv[1:]) - run_args(args) - - -if __name__ == "__main__": - main() diff --git a/playbooks/roles/update_ssh_config_vagrant/vars/main.yml b/playbooks/roles/update_ssh_config_vagrant/vars/main.yml deleted file mode 100644 index 76b0f920..00000000 --- a/playbooks/roles/update_ssh_config_vagrant/vars/main.yml +++ /dev/null @@ -1 +0,0 @@ -hosts_comma: "{{ ansible_play_hosts | join(',') }}" diff --git a/playbooks/update_ssh_config_vagrant.yml b/playbooks/update_ssh_config_vagrant.yml deleted file mode 100644 index c8d0e996..00000000 --- a/playbooks/update_ssh_config_vagrant.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- hosts: localhost - roles: - - role: update_ssh_config_vagrant -- 2.47.2