openstack-ansible-openstack.../tasks/openstack_hosts_configure_p...

70 lines
2.2 KiB
YAML

---
# Copyright 2018, Matthew Thode
#
# 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: Set up portage make.confd directory
file:
path: /etc/portage/make.confd
state: directory
mode: '0755'
owner: root
group: root
- name: add make.conf values
lineinfile:
path: /etc/portage/make.conf
line: "{{ item }}"
insertafter: "EOF"
with_items: "{{ openstack_host_gentoo_make_conf | list }}"
- name: Set use flags for default packages
lineinfile:
path: /etc/portage/package.use/osa_openstack_host
line: "{{ item }}"
state: present
mode: '0644'
create: yes
owner: root
group: root
with_items: "{{ openstack_host_distro_use_flags | list }}"
- name: Set package keywords
lineinfile:
path: /etc/portage/package.keywords/osa_openstack_host
line: "{{ item }}"
state: present
mode: '0644'
create: yes
owner: root
group: root
with_items: "{{ openstack_host_distro_keywords | list }}"
- 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 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