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

65 lines
1.6 KiB
YAML

- import_tasks: precheck.yml
tags:
- always
- name: From image {{ source_image }}
command: buildah from {{ source_image }}
register: from_image_cmd
- name: Set from_image
set_fact:
from_image: "{{ from_image_cmd.stdout }}"
- name: Run buildah config
command: >
buildah config
--label modified_append_tag={{ modified_append_tag }}
--workingdir / {{ from_image }}
- name: Create tempfile name for yum_update.sh
tempfile:
state: file
register: yum_update
- name: Prepare yum_update.sh script
copy:
src: files/yum_update.sh
dest: "{{ yum_update.path }}"
mode: 0755
- name: List file repos
shell: sed -n 's|baseurl=file://||p' *.repo
args:
chdir: "{{ yum_repos_dir_path }}"
register: file_repos
- name: Run yum_update.sh
command: >
buildah run
--volume {{ yum_update.path }}:/tmp/yum_update.sh
--volume {{ yum_repos_dir_path }}:/etc/yum.repos.d
{% for repo in file_repos.stdout_lines %}
{% if repo|exists %}
--volume {{ repo }}:{{ repo }}
{% endif %}
{% endfor %}
--user root
--net host
{{ from_image }}
/tmp/yum_update.sh "{{ update_repo }}"
retries: 3
delay: 3
register: result
until: result.rc == 0
- name: Remove temporary yum_update.sh script
file:
path: "{{ yum_update.path }}"
state: absent
- name: Commit changes to image {{ target_image | default(source_image) }}{{ modified_append_tag }}
command: >
buildah commit
{{ from_image }}
{{ target_image | default(source_image) }}{{ modified_append_tag }}