Skip to content

Commit

Permalink
Add Tumbleweed for the salt_env module
Browse files Browse the repository at this point in the history
  • Loading branch information
ycedres committed May 21, 2024
1 parent c89db10 commit 6a7b31e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 6 deletions.
2 changes: 2 additions & 0 deletions backend_modules/libvirt/base/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ locals {
slmicro60o = "${var.use_mirror_images ? "http://${var.mirror}" : "http://download.opensuse.org"}/repositories/systemsmanagement:/sumaform:/images:/microos/images_60/SL-Micro.x86_64-sumaform.qcow2"
suma43VM-ign = "${var.use_mirror_images ? "http://${var.mirror}" : "http://download.suse.de"}/ibs/Devel:/Galaxy:/Manager:/4.3/images/SUSE-Manager-Server.x86_64-KVM-x86_64.qcow2"
leapmicro55o = "${var.use_mirror_images ? "http://${var.mirror}" : "https://download.opensuse.org"}/distribution/leap-micro/5.5/appliances/openSUSE-Leap-Micro.x86_64-Default-qcow.qcow2"
tumbleweedo = "${var.use_mirror_images ? "http://${var.mirror}" : "https://download.opensuse.org"}/tumbleweed/appliances/openSUSE-Tumbleweed-Minimal-VM.x86_64-Cloud.qcow2"

}
pool = lookup(var.provider_settings, "pool", "default")
network_name = lookup(var.provider_settings, "network_name", "default")
Expand Down
15 changes: 15 additions & 0 deletions backend_modules/libvirt/host/user_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ chpasswd:
list: |
root:linux
%{ if image == "tumbleweedo"}
runcmd:
- echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
- systemctl restart sshd
- zypper --non-interactive install avahi avahi-lang
zypper:
repos:
- id: tools_pool_repo
baseurl: http://${ use_mirror_images ? mirror : "download.opensuse.org"}/repositories/systemsmanagement:/saltstack/openSUSE_Tumbleweed/
enabled: true
gpgcheck: false
name: tools_pool_repo
packages: ["salt","salt-minion"]
%{endif}

%{ if image == "centos7o" }
yum_repos:
# repo for salt
Expand Down
2 changes: 1 addition & 1 deletion backend_modules/null/base/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ variable "provider_settings" {

variable "images" {
description = "list of images to be uploaded to the libvirt host, leave default for all"
default = [ "almalinux8o", "almalinux9o", "amazonlinux2o", "centos7o", "libertylinux9o", "opensuse154o", "opensuse155o", "oraclelinux9o", "rocky8o", "rocky9o", "sles12sp4o", "sles12sp5o", "sles15sp3o", "sles15sp4o", "ubuntu2004o", "ubuntu2204o" ]
default = [ "almalinux8o", "almalinux9o", "amazonlinux2o", "centos7o", "libertylinux9o", "opensuse154o", "opensuse155o", "oraclelinux9o", "rocky8o", "rocky9o", "sles12sp4o", "sles12sp5o", "sles15sp3o", "sles15sp4o", "ubuntu2004o", "ubuntu2204o", "tumbleweedo" ]
type = set(string)
}

Expand Down
2 changes: 1 addition & 1 deletion modules/salt_testenv/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module "salt_testenv" {
ssh_key_path = var.ssh_key_path
image = var.image
provider_settings = var.provider_settings
install_salt_bundle = true
install_salt_bundle = var.install_salt_bundle

grains = {
mirror = var.base_configuration["mirror"]
Expand Down
5 changes: 5 additions & 0 deletions modules/salt_testenv/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ variable "image" {
type = string
default = "opensuse155o"
}

variable "install_salt_bundle" {
description = "use true to install the venv-salt-minion package in the hosts"
default = true
}
2 changes: 1 addition & 1 deletion salt/default/hostname.sls
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ legacy_permanent_hostname:
- follow_symlinks: False
- contents: {{ grains['hostname'] }}.{{ grains['domain'] }}

{% if grains['os_family'] == 'Suse' and grains["osfullname"] != 'SL-Micro' %}
{% if grains['os_family'] == 'Suse' and grains["osfullname"] not in ['SL-Micro', 'openSUSE Tumbleweed'] %}
change_searchlist:
file.replace:
- name: /etc/sysconfig/network/config
Expand Down
1 change: 1 addition & 0 deletions salt/repos/default.sls
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ install_{{ keypath }}:
{% endfor %}

{% if grains['os'] == 'SUSE' %}

{% if grains['osfullname'] == 'Leap' %}
os_pool_repo:
pkgrepo.managed:
Expand Down
21 changes: 18 additions & 3 deletions salt/salt_testenv/init.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include:
- default

{% if (grains['os'] == 'SUSE' and grains['osrelease_info'][0] == 15) or (grains['os_family'] == 'Suse' and grains['osfullname'] == 'SL-Micro') %}
{% if (grains['os'] == 'SUSE' and grains['osrelease_info'][0] == 15) or (grains['os_family'] == 'Suse' and grains['osfullname'] in ['SL-Micro', 'openSUSE Tumbleweed']) %}
{% if grains['osfullname'] == 'SLES' %}
{% set repo_path = "15" if grains["osrelease"] == 15 else "15-SP" + grains["osrelease_info"][1]|string %}
development_tools_repo_pool:
Expand Down Expand Up @@ -34,14 +34,15 @@ containers_updates_repo:
pkgrepo.managed:
- baseurl: http://{{ grains.get("mirror") | default("download.suse.de/ibs", true) }}/SUSE/Updates/SLE-Module-Containers/{{ repo_path }}/x86_64/update/
- refresh: True
{% endif %}

{% if grains['osfullname'] == 'SLES' and grains['osrelease_info'][1] >= 3 %}
{% if grains['osrelease_info'][1] >= 3 %}
{% set repo_path = grains["osrelease"] %}
{% else %}
{% set repo_path = "SLE_15_SP" + grains["osrelease_info"][1]|string %}
{% endif %}

{% endif %}

{% if grains['os_family'] == 'Suse' and grains['osfullname'] == 'SL-Micro' %}
{% set repo_path = 'SLMicro' + grains['osrelease_info'][0]|string + grains['osrelease_info'][1]|string %}
os_pool_repo:
Expand All @@ -55,6 +56,16 @@ alp_sources_repo:
- refresh: True
{% endif %}

{% if grains['os_family'] == 'Suse' and grains['osfullname'] == 'openSUSE Tumbleweed' %}
repo-oss:
pkgrepo.managed:
- baseurl: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/tumbleweed/repo/oss/
- refresh: True
- gpgcheck: False

{% set repo_path = 'openSUSE_Tumbleweed' %}
{% endif %}

salt_testsuite_dependencies_repo:
pkgrepo.managed:
- baseurl: http://{{ grains.get("mirror") | default("download.opensuse.org", true) }}/repositories/systemsmanagement:saltstack:products:test-dependencies/{{ repo_path }}/
Expand Down Expand Up @@ -135,6 +146,8 @@ start_docker_service:
{% endif %}
{% endif %}

{% if grains['osfullname'] != 'openSUSE Tumbleweed' %}

{% if grains["salt_obs_flavor"] == "saltstack:products" %}
{% set salt_flavor_path = "saltstack:bundle" %}
{% elif grains["salt_obs_flavor"] == "saltstack:products:testing" %}
Expand Down Expand Up @@ -170,6 +183,8 @@ install_salt_bundle_testsuite:
- require:
- pkgrepo: salt_bundle_testsuite_repo

{% endif %}

{% if grains['os_family'] == 'Suse' and grains['osfullname'] == 'SL-Micro' %}
copy_salt_classic_testsuite:
cmd.run:
Expand Down

0 comments on commit 6a7b31e

Please sign in to comment.