133ca093f9
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: I3b8c727e503577fc911f4be4f9a296739d71806f
91 lines
3.3 KiB
YAML
91 lines
3.3 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.
|
|
|
|
# NOTE(hwoarang) snapper make take significant amount of CPU time
|
|
# when executing zypper over and over so it's best to disable the
|
|
# background comparison process. Snapper may need further tuning
|
|
# for example reducing the number of snapshots to keep, disable daily
|
|
# cleanup job etc but these may come later in the future if needed.
|
|
- name: Check if Snapper root configuration file exists
|
|
stat:
|
|
path: "/etc/snapper/configs/root"
|
|
register: snapper_root_config
|
|
|
|
- name: Disable background snapshot comparisons on Snapper
|
|
lineinfile:
|
|
path: "/etc/snapper/configs/root"
|
|
regexp: '^BACKGROUND_COMPARISON=.*'
|
|
line: 'BACKGROUND_COMPARISON="no"'
|
|
state: present
|
|
when:
|
|
- snapper_root_config.stat.exists
|
|
|
|
- name: Remove the blacklisted packages
|
|
package:
|
|
name: "{{ openstack_hosts_package_list | selectattr('state','equalto','absent') | map(attribute='name') | list }}"
|
|
state: absent
|
|
|
|
- name: If a keyfile is provided, copy the gpg keyfile to the key location
|
|
copy:
|
|
src: "{{ item.keyfile }}"
|
|
dest: "{{ item.key }}"
|
|
with_items: "{{ openstack_hosts_package_repos_keys | selectattr('keyfile','defined') | list }}"
|
|
|
|
- name: Add/Remove repositories gpg keys manually
|
|
rpm_key:
|
|
key: "{{ key.key }}"
|
|
state: "{{ key.state | default('present') }}"
|
|
validate_certs: "{{ key.validate_certs | default(omit) }}"
|
|
with_items: "{{ openstack_hosts_package_repos_keys }}"
|
|
loop_control:
|
|
loop_var: key
|
|
register: _add_rpm_keys
|
|
until: _add_rpm_keys is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Add requirement packages (repositories gpg keys, toolkits...)
|
|
zypper:
|
|
name: "{{ openstack_hosts_package_list | rejectattr('state','equalto','absent') | map(attribute='name') | list }}"
|
|
state: "{{ openstack_hosts_package_state }}"
|
|
when:
|
|
- (openstack_hosts_package_list | rejectattr('state','equalto','absent') | map(attribute='name') | list | length) > 0
|
|
|
|
- name: Add/Remove/Update standard and user defined repositories
|
|
zypper_repository:
|
|
repo: "{{ repo.repo }}"
|
|
state: "{{ repo.state | default('present') }}"
|
|
name: "{{ repo.name | default(omit) }}"
|
|
enabled: "{{ repo.enabled | default(omit) }}"
|
|
disable_gpg_check: "{{ repo.disable_gpg_check | default(omit) }}"
|
|
description: "{{ repo.description | default(omit) }}"
|
|
autorefresh: "{{ repo.autorefresh | default(omit) }}"
|
|
auto_import_keys: "{{ repo.auto_import_keys | default(omit) }}"
|
|
priority: "{{ repo.priority | default(omit) }}"
|
|
with_items: "{{ openstack_hosts_package_repos }}"
|
|
loop_control:
|
|
loop_var: repo
|
|
register: _adding_repo
|
|
until: _adding_repo is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Refresh repositories if necessary
|
|
zypper_repository:
|
|
repo: '*'
|
|
runrefresh: yes
|
|
when:
|
|
- _adding_repo is changed
|