add install oc file
This commit is contained in:
@@ -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
|
||||
|
||||
39
.install_oc.yaml
Normal file
39
.install_oc.yaml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user