From 046b0534b33fc6cbb278711181e3879e4473f763 Mon Sep 17 00:00:00 2001 From: Wolfgang Kulhanek <WolfgangKulhanek@gmail.com> Date: Thu, 30 Jan 2020 18:19:36 +0100 Subject: [PATCH] Add k8s virtualenv to ocp4-workshop config to encapsulate workloads. --- ansible/configs/ocp4-workshop/files/requirements_k8s.txt | 40 ++++++++++++++++++++ ansible/configs/ocp4-workshop/pre_software.yml | 31 +++++++++++++++ ansible/configs/ocp4-workshop/ocp_workloads.yml | 3 + 3 files changed, 74 insertions(+), 0 deletions(-) diff --git a/ansible/configs/ocp4-workshop/files/requirements_k8s.txt b/ansible/configs/ocp4-workshop/files/requirements_k8s.txt new file mode 100644 index 0000000..370d2f2 --- /dev/null +++ b/ansible/configs/ocp4-workshop/files/requirements_k8s.txt @@ -0,0 +1,40 @@ +adal==1.2.2 +ansible==2.8.8 +asn1crypto==1.3.0 +bcrypt==3.1.7 +cachetools==4.0.0 +certifi==2019.11.28 +cffi==1.13.2 +chardet==3.0.4 +cryptography==2.8 +dictdiffer==0.8.1 +distro==1.4.0 +google-auth==1.10.2 +idna==2.8 +Jinja2==2.10.3 +jmespath==0.9.4 +k8s==0.14.0 +kubernetes==10.0.1 +MarkupSafe==1.1.1 +oauthlib==3.1.0 +openshift==0.10.1 +paramiko==2.7.1 +pyasn1==0.4.8 +pyasn1-modules==0.2.8 +pycparser==2.19 +PyJWT==1.7.1 +PyNaCl==1.3.0 +pyRFC3339==1.1 +python-dateutil==2.8.1 +python-string-utils==0.6.0 +pytz==2019.3 +PyYAML==5.3 +requests==2.22.0 +requests-oauthlib==1.3.0 +rsa==4.0 +ruamel.yaml==0.16.6 +ruamel.yaml.clib==0.2.0 +selinux==0.2.1 +six==1.14.0 +urllib3==1.25.8 +websocket-client==0.57.0 \ No newline at end of file diff --git a/ansible/configs/ocp4-workshop/ocp_workloads.yml b/ansible/configs/ocp4-workshop/ocp_workloads.yml index 9b62ba1..1544cf3 100644 --- a/ansible/configs/ocp4-workshop/ocp_workloads.yml +++ b/ansible/configs/ocp4-workshop/ocp_workloads.yml @@ -8,6 +8,9 @@ run_once: true become: false tasks: + - name: Set Ansible Python interpreter to k8s virtualenv + set_fact: + ansible_python_interpreter: /opt/virtualenvs/k8s/bin/python - name: Install ocp-default workloads when: - default_workloads | d("") | length > 0 diff --git a/ansible/configs/ocp4-workshop/pre_software.yml b/ansible/configs/ocp4-workshop/pre_software.yml index 530ebae..56663cd 100644 --- a/ansible/configs/ocp4-workshop/pre_software.yml +++ b/ansible/configs/ocp4-workshop/pre_software.yml @@ -51,6 +51,37 @@ - step004 - bastion_tasks +- name: Create a Python3 VirtualEnv for use in the k8s Ansible tasks + hosts: bastions + gather_facts: false + become: true + tasks: + - name: Setup pre-requisite python3 packages + package: + state: present + name: + - git + - python3-pip + + - name: Setup pre-requisite pip3 packages + pip: + name: + - virtualenv + state: present + executable: /usr/bin/pip3 + + - name: Copy requirements.txt to target for k8s virtualenv + copy: + src: ./files/requirements_k8s.txt + dest: /tmp/requirements_k8s.txt + + - name: "Create virtualenv k8s" + pip: + requirements: /tmp/requirements_k8s.txt + virtualenv: "/opt/virtualenvs/k8s" + virtualenv_site_packages: no + virtualenv_command: /usr/local/bin/virtualenv + - name: PreSoftware flight-check hosts: localhost connection: local -- Gitblit v1.9.3