Merge "Remove support for openSUSE"

This commit is contained in:
Zuul 2021-02-23 10:50:49 +00:00 committed by Gerrit Code Review
commit 9e76dc945f
10 changed files with 1 additions and 259 deletions

View File

@ -172,7 +172,7 @@ lxc_cache_prep_post_commands: '## post command skipped ##'
# "{{ ansible_distribution }}-{{ ansible_distribution_version }}-container.yml"
# or by providing the full path to a local file containing all of the variables
# needed to prepare a container. built-in supported values are:
# [redhat-7.yml, suse-42.yml, ubuntu-16.04.yml, ubuntu-18.04.yml]
# [redhat-7.yml, ubuntu-16.04.yml, ubuntu-18.04.yml]
#lxc_user_defined_container: null
# Full path to the base image prep script. By default this will use the
@ -253,11 +253,3 @@ lxc_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraprojec
lxc_centos_package_baseurl: "{{ _lxc_centos_package_baseurl }}"
lxc_centos_package_key: "{{ _lxc_centos_package_key }}"
## Set default mirror for openSUSE repositories
# NOTE(hwoarang): Ensure that the full path to the 'opensuse' directory is used.
# Additionally, set 'lxc_hosts_opensuse_mirror_obs_url' to a mirror which also mirrors
# the OBS repositories. If you want to use the same mirror in both cases, then leave the
# 'lxc_hosts_opensuse_mirror_obs_url' to its default value.
lxc_hosts_opensuse_mirror_url: "{{ opensuse_mirror | default('http://download.opensuse.org') }}"
lxc_hosts_opensuse_mirror_obs_url: "{{ lxc_hosts_opensuse_mirror_url }}"

View File

@ -27,9 +27,6 @@ galaxy_info:
- name: EL
versions:
- 8
- name: opensuse
versions:
- 15.0
categories:
- cloud
- lxc

View File

@ -1,65 +0,0 @@
---
# Copyright 2017, SUSE LINUX GmbH.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Add zypper containers repository
zypper_repository:
auto_import_keys: yes
autorefresh: yes
name: "{{ item.name }}"
repo: "{{ item.uri }}"
runrefresh: yes
state: "{{ item.state }}"
with_items: "{{ lxc_hosts_external_repo }}"
when: lxc_hosts_external_repo is defined
tags:
- lxc_hosts-config
- name: Install zypper packages
zypper:
name: "{{ lxc_hosts_distro_packages }}"
state: "{{ lxc_hosts_package_state }}"
register: install_packages
until: install_packages is success
retries: 5
delay: 2
tags:
- lxc-packages
# NOTE(hwoarang) The newuidmap and newgidmap binaries do not have setuid bit
# set and that causes lxc-2.X.X to fail. As such, make sure the files have
# the correct mode.
# https://bugzilla.opensuse.org/show_bug.cgi?id=1054609
- name: Set setuid bit for newuidmap and newgidmap binaries (bsc#1054609)
file:
path: "{{ item }}"
mode: 04755
with_items:
- "/usr/bin/newuidmap"
- "/usr/bin/newgidmap"
tags:
- lxc-files
- lxc_hosts-config
- include_tasks: lxc_apparmor.yml
- name: Flush handler to reload apparmor profiles
meta: flush_handlers
- name: Enable lxc service
service:
name: lxc
enabled: "yes"
tags:
- lxc_hosts-config

View File

@ -55,25 +55,6 @@
path: "/etc/sysconfig/network-scripts/ifup-post-{{ lxc_net_bridge }}"
state: "absent"
- name: Drop lxc net bridge routes (SUSE)
template:
src: "lxc-net-suse-routes.cfg.j2"
dest: "/etc/sysconfig/network/ifroute-{{ lxc_net_bridge }}"
owner: "root"
group: "root"
mode: "0644"
when:
- lxc_net_gateway is not none
- ansible_pkg_mgr == "zypper"
notify:
- Bring bridge up
- Reload networkd
tags:
- lxc-files
- lxc-net
- lxc-bridge
- lxc-interfaces
# NOTE(mhayden): There are ifup hooks that handle the customized LXC container
# networking. Starting lxc-net will trample over these hooks and cause
# networking issues for containers.

View File

@ -1,12 +0,0 @@
# {{ ansible_managed }}
BRIDGE='yes'
IPADDR={{ lxc_net_address }}
NETMASK={{ lxc_net_netmask }}
BOOTPROTO=static
STARTMODE=auto
BRIDGE_STP='off'
# POST_UP script
POST_UP_SCRIPT="compat:suse:ifup-post-{{ lxc_net_bridge }}"
# POST_DOWN script
POST_DOWN_SCRIPT="compat:suse:ifdown-post-{{ lxc_net_bridge }}"

View File

@ -1 +0,0 @@
default {{ lxc_net_gateway }}

View File

@ -1,48 +0,0 @@
#!/usr/bin/env bash
set -e -x
{{ lxc_cache_prep_pre_commands }}
{% include 'templates/prep-scripts/_container_sys_setup.sh.j2' %}
# We have (tried to!) copied repo-oss and repo-update from the host so wipe everything else.
find /etc/zypp/repos.d/ -type f ! -name "repo-oss.repo" -a ! -name "repo-update.repo" -delete
zypper lr | grep -q 'repo-oss' || zypper --quiet ar {{ lxc_hosts_opensuse_mirror_url }}/distribution/leap/{{ lxc_cache_map.release }}/repo/oss repo-oss
zypper lr | grep -q 'repo-update' || zypper --quiet ar {{ lxc_hosts_opensuse_mirror_url }}/update/leap/{{ lxc_cache_map.release }}/oss repo-update
# Disable recommended packages. Only update what's really needed
if ! fgrep -qx "solver.onlyRequires = true" /etc/zypp/zypp.conf; then
echo -e "\n\n## Disable recommended packages\nsolver.onlyRequires = true" >> /etc/zypp/zypp.conf
fi
# Update base distribution
zypper --gpg-auto-import-keys -n dup --force-resolution -l
zypper --gpg-auto-import-keys -n in --force-resolution -l {{ lxc_cache_distro_packages | join(' ') }}
mkdir -p /var/backup
chage -I -1 -d -1 -m 0 -M 99999 -E -1 root
# NOTE(hwoarang): Enable sshd which has been explicitely disabled in
# https://github.com/lxc/lxc-ci/commit/8dc7105399350a59698538a12b6d5a1a880ef2ba
if systemctl list-unit-files sshd.service | egrep '(masked|disabled)'; then
systemctl -q unmask sshd
systemctl -q enable sshd
fi
rm /etc/machine-id || true
rm /var/lib/dbus/machine-id || true
touch /etc/machine-id
rm /etc/sysctl.d/* || true
echo '' > /etc/sysctl.conf
for action in disable mask; do
systemctl ${action} wicked.service || true
systemctl ${action} wickedd.service || true
systemctl ${action} wickedd-auto4.service || true
systemctl ${action} wickedd-dhcp4.service || true
systemctl ${action} wickedd-dhcp6.service || true
systemctl ${action} wickedd-nanny.service || true
done
# Set the IP of the lxcbr0 interface as the DNS server
echo "nameserver {{ lxc_net_address }}" > /etc/resolv.conf
systemctl enable systemd-networkd
{{ lxc_cache_prep_post_commands }}

View File

@ -92,11 +92,6 @@
interface_file: "{{ lookup('pipe', 'cat /etc/sysconfig/network-scripts/ifcfg-lxcbr0 | tail -n +3') }}"
when: ansible_os_family | lower == "redhat"
- name: SUSE - Get deployed interface file contents, without Ansible managed line
set_fact:
interface_file: "{{ lookup('pipe', 'cat /etc/sysconfig/network/ifcfg-lxcbr0 | tail -n +3') }}"
when: ansible_os_family | lower == "suse"
- name: Get bridge interface facts
setup:
filter: ansible_lxcbr0

View File

@ -1,49 +0,0 @@
---
# Copyright 2016, Rackspace US, Inc.
# Copyright 2017, SUSE LINUX GmbH.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
lxc_hosts_external_repo: []
system_config_dir: "/etc/sysconfig"
systemd_utils_prefix: "/usr/lib/systemd"
# Required rpm packages.
_lxc_hosts_distro_packages:
- apparmor-parser
- apparmor-profiles
- apparmor-utils
- aria2
- bridge-utils
- btrfsprogs
- dbus-1
- dnsmasq
- git-core
- libseccomp2
- lxc
- liblxc-devel
- procps
- python-lxc-python2
- systemd-container
- xz
lxc_xz_bin: xz
lxc_cached_network_interfaces:
- src: "lxc-net-suse-bridge.cfg.j2"
dest: "/etc/sysconfig/network/ifcfg-{{ lxc_net_bridge }}"
- src: "lxc-net-suseredhat-postdown.cfg.j2"
dest: "/etc/sysconfig/network/scripts/ifdown-post-{{ lxc_net_bridge }}"
mode: "0755"
interface: "${1}"

View File

@ -1,48 +0,0 @@
---
# Copyright 2016, Rackspace US, Inc.
# Copyright 2017, SUSE LINUX GmbH.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_lxc_hosts_container_image_url_base: "https://download.opensuse.org/repositories/Virtualization:/containers:/images:/openSUSE-Leap-{{ ansible_distribution_version }}/containers/"
# NOTE(evrardjp): This is now a versionless image name and should stay that way.
# If this has changed, ping a openSUSE community member or a SUSE employee.
# In download.opensuse.org mirrors, this url should be redirected to a metalink file.
# In any mirror it's more likely this url would be redirected to the .tar.xz file (application/octet-stream)
_lxc_hosts_container_image_url: "{{ _lxc_hosts_container_image_url_base }}opensuse-leap-image.x86_64-lxc.tar.xz"
_lxc_cache_map:
distro: opensuse
arch: "{{ lxc_architecture_mapping.get( ansible_architecture ) }}"
release: "{{ ansible_distribution_version }}"
copy_from_host:
- /etc/default/locale
- /etc/environment
- /etc/localtime
- /etc/locale.conf
- /etc/protocols
- /etc/zypp/repos.d/repo-oss.repo
- /etc/zypp/repos.d/repo-update.repo
_lxc_cache_prep_template: "prep-scripts/opensuse_leap_prep.sh.j2"
# This list should contain a minimum set of packages. Add extra packages via roles that require them.
_lxc_cache_distro_packages:
- ca-certificates-mozilla
- iputils
- openssh
- python
- sudo
- systemd
- systemd-sysvinit
- timezone