Created
June 23, 2020 07:45
-
-
Save kameshsampath/9f1953e324a30062357cbeeaaa941d7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ansible-playbook -c local | |
--- | |
- hosts: localhost | |
vars: | |
dest_dir: "{{ansible_env.HOME}}/openshift/bin" | |
tasks: | |
- name: OS | |
debug: msg="OS Family is {{ansible_os_family}}" | |
- name: Make sure destination exists | |
file: | |
path: "{{dest_dir}}" | |
state: directory | |
mode: 0755 | |
- name: Set Linux Downloadables | |
set_fact: | |
download_files: | |
- "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz" | |
- "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux.tar.gz" | |
when: ansible_os_family == "RedHat" or ansible_os_family == "CentOS" or ansible_os_family == "Debian" | |
- name: Set macOS Downloadables | |
set_fact: | |
download_files: | |
- "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-mac.tar.gz" | |
- "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-mac.tar.gz" | |
when: ansible_os_family == "Darwin" | |
- name: Set Windows Downloadables | |
set_fact: | |
download_files: | |
- "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-windows.zip" | |
when: ansible_os_family == "Windows" | |
- name: Dowload Clients | |
unarchive: | |
remote_src: true | |
src: "{{item}}" | |
dest: "{{dest_dir}}" | |
mode: 0755 | |
exclude: | |
- "README.md" | |
with_items: "{{download_files}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment