openstack-ansible-lxc_hosts/tasks/lxc_install_zypper.yml
Jean-Philippe Evrard 15d4a21f4a Fix usage of "|" for tests
With the more recent versions of ansible, we should now use
"is" instead of the "|" sign for the tests.

This should fix it.

Change-Id: I7ba6ca7d7c8a9bbaf85933370d0ced9931f9a34b
2018-07-12 17:03:19 +02:00

88 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
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', '>=')