From c1d7312500a3f85a632bb689f42f22914638400f Mon Sep 17 00:00:00 2001 From: Karen Zeng Date: Wed, 7 Jun 2023 16:23:24 -0400 Subject: [PATCH] Add checkout repository and and pip install python requirements --- basic_checks.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/basic_checks.yml b/basic_checks.yml index 9f14b87..c501438 100644 --- a/basic_checks.yml +++ b/basic_checks.yml @@ -5,8 +5,8 @@ fail: msg: "Package manager is not apt" when: "ansible_pkg_mgr != 'apt'" - -- name: Add git task to basic checks playbook + +- name: Check out the pricer repository hosts: all tasks: - name: Checkout pricer repository @@ -16,4 +16,24 @@ version: main become: yes become_user: root + +- name: Install Python requirements + hosts: all + tasks: + - name: Install Python requirements + ansible.builtin.pip: + requirements: /opt/pricer/requirements.txt + become: yes + + - name: Install missing packages with apt + apt: + name: "{{ item }}" + state: present + become: yes + with_lines: + cmd: "pip show {{ item }}" + register: pip_packages + changed_when: pip_packages.rc != 0 + loop_control: + loop_var: item