
The state of the Containers repository depends on the Leap version that's being used. Before this patch, we did not override the default value of the 'state' option so the repository was always added. However, we don't need to use this repo for Leap 15 so we need to use the 'state' value from the distro variables. Change-Id: Ia41ffaa21fede271263c1757de949e65f6f30a67
89 lines
2.9 KiB
YAML
89 lines
2.9 KiB
YAML
---
|
|
# 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
|
|
|
|
- name: Determine latest openSUSE container build information (Leap 15)
|
|
# Leap 15.0
|
|
block:
|
|
# NOTE(hwoarang) The build ID changes all the time so we need to have a hack to determine the latest one
|
|
# TODO: Talk to openSUSE people to improve that and possibly use the same location for 42.3 as well.
|
|
- shell: |
|
|
curl -s {{ _lxc_hosts_container_image_url_base }} | grep -P -o '{{ ansible_architecture }}.*?lxc.*?Buildlp.*?xz' | head -n 1
|
|
register: _lxc_opensuse_image_build_info
|
|
- set_fact:
|
|
opensuse_image_build_info: "{{ _lxc_opensuse_image_build_info.stdout }}"
|
|
when: ansible_distribution_version is version ('42', '<')
|
|
|
|
- name: Determine latest openSUSE container build information (Leap 42)
|
|
# Leap 42
|
|
block:
|
|
- uri:
|
|
url: "{{ _lxc_hosts_container_image_url_base }}/Dockerfile"
|
|
return_content: true
|
|
register: _lxc_opensuse_image_build_info
|
|
- set_fact:
|
|
opensuse_image_build_info: "{{ _lxc_opensuse_image_build_info.content|regex_search('Version: (.*)', '\\1')|join(' ') }}"
|
|
when: ansible_distribution_version is version ('42', '>=')
|