diff options
author | Thomas Wiest <twiest@users.noreply.github.com> | 2015-04-09 15:24:58 -0400 |
---|---|---|
committer | Thomas Wiest <twiest@users.noreply.github.com> | 2015-04-09 15:24:58 -0400 |
commit | cd953f338d6678cc4c89d27a9aa457eabd29140d (patch) | |
tree | bb1a72d8021f5cab575213854c88488256c58567 /roles/yum_repos/tasks | |
parent | f0ae24d8346ba8cafe6c8f9890433789b5367078 (diff) | |
parent | f28ff57f98140a1a22423df34d6457ee669fe714 (diff) | |
download | openshift-cd953f338d6678cc4c89d27a9aa457eabd29140d.tar.gz openshift-cd953f338d6678cc4c89d27a9aa457eabd29140d.tar.bz2 openshift-cd953f338d6678cc4c89d27a9aa457eabd29140d.tar.xz openshift-cd953f338d6678cc4c89d27a9aa457eabd29140d.zip |
Merge pull request #147 from detiber/refactor_yum_repos
refactor yum_repo role to handle multiple repos/files
Diffstat (limited to 'roles/yum_repos/tasks')
-rw-r--r-- | roles/yum_repos/tasks/main.yml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/roles/yum_repos/tasks/main.yml b/roles/yum_repos/tasks/main.yml new file mode 100644 index 000000000..a9903c6c6 --- /dev/null +++ b/roles/yum_repos/tasks/main.yml @@ -0,0 +1,47 @@ +--- +# Convert old params to new params +- set_fact: + repo_files: + - id: "{{ repo_tag }}" + repos: + - id: "{{ repo_tag }}" + name: "{{ repo_name }}" + baseurl: "{{ repo_baseurl }}" + enabled: "{{ repo_enabled }}" + gpgcheck: "{{ repo_gpg_check | default(repo_gpgcheck) }}" + sslverify: "{{ repo_sslverify | default(None) }}" + sslclientcert: "{{ repo_sslclientcert | default(None) }}" + sslclientkey: "{{ repo_sslclientkey | default(None) }}" + gpgkey: "{{ repo_gpgkey | default(None) }}" + when: repo_files is not defined + +- name: Verify repo_files is a list + assert: + that: + - repo_files is iterable and repo_files is not string and repo_files is not mapping + +- name: Verify repo_files items have an id and a repos list + assert: + that: + - item is mapping + - "'id' in item" + - "'repos' in item" + - item.repos is iterable and item.repos is not string and item.repos is not mapping + with_items: repo_files + +- name: Verify that repo_files.repos have the required keys + assert: + that: + - item.1 is mapping + - "'id' in item.1" + - "'name' in item.1" + - "'baseurl' in item.1" + with_subelements: + - repo_files + - repos + +- name: Installing yum-repo template + template: + src: yumrepo.j2 + dest: /etc/yum.repos.d/{{ item.id }}.repo + with_items: repo_files |