tasks: lxc_install_zypper: Use the 'state' option for external repos

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
This commit is contained in:
Markos Chandras 2018-09-25 16:19:32 +01:00
parent fc456f65aa
commit 79bdebb9de
3 changed files with 3 additions and 1 deletions

View File

@ -20,6 +20,7 @@
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:

View File

@ -17,6 +17,7 @@
lxc_hosts_external_repo:
- name: "OBS:Virtualization:containers"
uri: "{{ lxc_hosts_opensuse_mirror_obs_url }}/repositories/Virtualization:/containers/openSUSE_Leap_{{ ansible_distribution_version }}/"
state: present
system_config_dir: "/etc/sysconfig"
systemd_utils_prefix: "/usr/lib/systemd"

View File

@ -20,7 +20,7 @@ lxc_hosts_external_repo:
# NOTE(hwoarang) Leap 15.X is newer than 42.X and it has all the necessary LXC packages so we don't need
# to use the OBS repository. As such we only add it if version is >= 42 so we can capture all the old Leap
# releases. Using the external repo can be removed once we drop support for 42.X
state: "{{ (ansible_distribution_version is version ('42', '>=')) | ternary ('present', 'absent') }}"
state: "{{ (ansible_distribution_major_version >= 42) | ternary ('present', 'absent') }}"
system_config_dir: "/etc/sysconfig"
systemd_utils_prefix: "/usr/lib/systemd"