Skip to content

Commit

Permalink
add install oc file
Browse files Browse the repository at this point in the history
  • Loading branch information
willtome committed Oct 24, 2023
1 parent 3266a94 commit 4a62ecd
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ components:
commands:
- id: oc-install
exec:
commandLine: '/usr/local/bin/ansible-playbook ${PROJECT_SOURCE}/playbooks/install_oc.yml'
commandLine: '/usr/local/bin/ansible-playbook ${PROJECT_SOURCE}/.install_oc.yaml'
workingDir: ${PROJECT_SOURCE}
group:
kind: build
Expand Down
39 changes: 39 additions & 0 deletions .install_oc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: false
vars:
molecule_pip_dependencies:
- kubernetes
tasks:

- name: Store user ENVs
ansible.builtin.set_fact:
molecule_user_home_dir: "{{ lookup('ansible.builtin.env', 'HOME') }}"
molecule_user_path: "{{ lookup('ansible.builtin.env', 'PATH') }}"

- name: Create local bin directory
ansible.builtin.file:
path: "{{ molecule_user_home_dir }}/bin"
state: directory
mode: 0770

- name: Download oc binary from OCP downloads svc endpoint
ansible.builtin.get_url:
url: http://downloads.openshift-console.svc.cluster.local/amd64/linux/oc
dest: "{{ molecule_user_home_dir }}/bin/oc"
mode: '0770'

- name: Add another bin dir to system-wide $PATH.
ansible.builtin.lineinfile:
path: "{{ molecule_user_home_dir }}/.bashrc"
line: 'PATH=$PATH:{{ molecule_user_home_dir }}/bin'
state: present

- name: Ensure python dependencies are installed
ansible.builtin.pip:
name: "{{ molecule_pip_dependencies }}"
state: present
when: molecule_pip_dependencies is defined

0 comments on commit 4a62ecd

Please sign in to comment.