kayobe/ansible/roles/yum/tasks/custom_repo.yml
Mark Goddard 6c5f72b550 Yum custom repo creation requires root
We can't assume the executing user is root, so use become.

Also uses a block to perform the RedHat-only check.

Change-Id: Ibf2da6b8086bc8e34b33f113067a213a33213161
Story: 2001898
Task: 14383
2018-04-23 15:37:50 +00:00

29 lines
1.3 KiB
YAML

---
- name: Install custom repositories
yum_repository:
name: "{{ item.key }}"
description: "{% if 'description' in item.value %}{{ item.value.description }}{% else %}{{ item.key }} repository{% endif %}"
baseurl: "{{ item.value.baseurl }}"
file: "{{ item.value.file | default(omit)}}"
gpgkey: "{{ item.value.gpgkey | default(omit)}}"
gpgcheck: "{{ item.value.gpgcheck | default(omit)}}"
cost: "{{ item.value.cost | default(omit)}}"
enabled: "{{ item.value.enabled | default(omit)}}"
gpgcakey: "{{ item.value.gpgcakey | default(omit)}}"
metadata_expire: "{{ item.value.metadata_expire | default(omit)}}"
mirrorlist: "{{ item.value.mirrorlist | default(omit)}}"
mirrorlist_expire: "{{ item.value.mirrorlist_expire | default(omit)}}"
priority: "{{ item.value.priority | default(omit)}}"
proxy: "{{ item.value.proxy | default(omit)}}"
proxy_password: "{{ item.value.proxy_password | default(omit)}}"
proxy_username: "{{ item.value.proxy_username | default(omit)}}"
repo_gpgcheck: "{{ item.value.repo_gpgcheck | default(omit)}}"
sslverify: "{{ item.value.sslverify | default(omit)}}"
with_dict: "{{ yum_custom_repos }}"
register: register_yum_command
retries: 3
delay: 10
until: "'failed' not in register_yum_command"
become: true