ansible-role-tripleo-modify.../tasks/yum_update.yml

77 lines
1.8 KiB
YAML

- import_tasks: precheck.yml
tags:
- always
- import_tasks: get_original_user.yml
- name: Create image build context directory
tempfile:
state: directory
prefix: tripleo-modify-image
register: context_dir
- name: Set modify_dir_path
set_fact:
modify_dir_path: "{{ context_dir.path }}"
- name: Copy directory used for /etc/yum.repos.d
copy:
src: "{{ yum_repos_dir_path }}"
dest: "{{ modify_dir_path }}/yum.repos.d"
when: yum_repos_dir_path is defined
- name: Copy local file repos to context directory
shell: |
#!/bin/sh
set -ex
# discover repos with local packages
repos=$(sed -n 's/baseurl=file:\/\///p' {{ yum_repos_dir_path }}/*.repo)
mkdir repos
for repo in $repos ; do
if [ -d $repo ]; then
target_dir=repos$repo
echo "copying $repo to $target_dir"
mkdir -p $target_dir
cp -a $repo/* $target_dir
fi
done
args:
chdir: "{{ modify_dir_path }}"
when: yum_repos_dir_path is defined
- name: Generate host package json file
block:
- command: |
rpm -qa --qf '"%{NAME}": "%{VERSION}-%{RELEASE}"\n'
register: rpm_query_output
- copy:
content: "{{ rpm_query_output.stdout | from_yaml | to_nice_json }}"
dest: "{{ modify_dir_path }}/host_packages.json"
when: compare_host_packages
- name: Write Dockerfile to {{ modify_dir_path }}
template:
src: Dockerfile-yum.j2
dest: "{{ modify_dir_path }}/Dockerfile"
- name: Write yum_update.sh
copy:
src: yum_update.sh
dest: "{{ modify_dir_path }}/yum_update.sh"
mode: '0555'
- name: Write compare-package-json.py
copy:
src: compare-package-json.py
dest: "{{ modify_dir_path }}/compare-package-json.py"
mode: '0555'
- include_tasks: modify_image.yml