Checked pricer repository and pip installed
This commit is contained in:
+28
-12
@@ -1,11 +1,21 @@
|
|||||||
- name: Basic system checks
|
- name: Basic system checks
|
||||||
hosts: all
|
hosts: all
|
||||||
|
become: yes
|
||||||
|
become_user: root
|
||||||
tasks:
|
tasks:
|
||||||
- name: Check to make sure the package manager is apt
|
- name: Check to make sure the package manager is apt
|
||||||
fail:
|
fail:
|
||||||
msg: "Package manager is not apt"
|
msg: "Package manager is not apt"
|
||||||
when: "ansible_pkg_mgr != 'apt'"
|
when: "ansible_pkg_mgr != 'apt'"
|
||||||
|
|
||||||
|
- name: Install git
|
||||||
|
hosts: all
|
||||||
|
tasks:
|
||||||
|
- name: Install git
|
||||||
|
apt:
|
||||||
|
name: git
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: Check out the pricer repository
|
- name: Check out the pricer repository
|
||||||
hosts: all
|
hosts: all
|
||||||
tasks:
|
tasks:
|
||||||
@@ -14,26 +24,32 @@
|
|||||||
repo: https://gogs.gtsplab.com:5432/SVIG/pricer.git
|
repo: https://gogs.gtsplab.com:5432/SVIG/pricer.git
|
||||||
dest: /opt/pricer
|
dest: /opt/pricer
|
||||||
version: main
|
version: main
|
||||||
become: yes
|
|
||||||
become_user: root
|
|
||||||
|
|
||||||
- name: Install Python requirements
|
- name: Install Python requirements
|
||||||
hosts: all
|
hosts: all
|
||||||
tasks:
|
tasks:
|
||||||
- name: Install Python requirements
|
- name: "Install setuptools + distutils + pkg-resources + pip"
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- python3-setuptools
|
||||||
|
- python3-distutils
|
||||||
|
- python3-pkg-resources
|
||||||
|
- python3-pip
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Install the pricer Python package dependencies
|
||||||
ansible.builtin.pip:
|
ansible.builtin.pip:
|
||||||
requirements: /opt/pricer/requirements.txt
|
requirements: /opt/pricer/requirements.txt
|
||||||
become: yes
|
|
||||||
|
- name: Check missing packages
|
||||||
|
command: "pip show {{ item }}"
|
||||||
|
register: pip_packages
|
||||||
|
changed_when: false
|
||||||
|
failed_when: "'WARNING: Package(s) not found' not in pip_packages.stderr"
|
||||||
|
loop: "{{ lookup('file', '/opt/pricer/requirements.txt').splitlines() }}"
|
||||||
|
|
||||||
- name: Install missing packages with apt
|
- name: Install missing packages with apt
|
||||||
apt:
|
apt:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
become: yes
|
loop: "{{ pip_packages.results | map(attribute='item') | list }}"
|
||||||
with_lines:
|
|
||||||
cmd: "pip show {{ item }}"
|
|
||||||
register: pip_packages
|
|
||||||
changed_when: pip_packages.rc != 0
|
|
||||||
loop_control:
|
|
||||||
loop_var: item
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user