Files
pricer/basic_checks.yml
T

56 lines
1.4 KiB
YAML
Raw Normal View History

2023-06-06 17:49:59 -04:00
- name: Basic system checks
hosts: all
2023-06-08 16:41:26 -04:00
become: yes
become_user: root
2023-06-06 17:49:59 -04:00
tasks:
- name: Check to make sure the package manager is apt
fail:
msg: "Package manager is not apt"
when: "ansible_pkg_mgr != 'apt'"
2023-06-07 16:23:24 -04:00
2023-06-08 16:41:26 -04:00
- name: Install git
hosts: all
tasks:
- name: Install git
apt:
name: git
state: present
2023-06-07 16:23:24 -04:00
- name: Check out the pricer repository
hosts: all
tasks:
- name: Checkout pricer repository
git:
repo: https://gogs.gtsplab.com:5432/SVIG/pricer.git
dest: /opt/pricer
version: main
2023-06-07 16:23:24 -04:00
- name: Install Python requirements
hosts: all
tasks:
2023-06-08 16:41:26 -04:00
- 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
2023-06-07 16:23:24 -04:00
ansible.builtin.pip:
requirements: /opt/pricer/requirements.txt
2023-06-08 16:41:26 -04:00
- 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() }}"
2023-06-07 16:23:24 -04:00
- name: Install missing packages with apt
apt:
name: "{{ item }}"
state: present
2023-06-08 16:41:26 -04:00
loop: "{{ pip_packages.results | map(attribute='item') | list }}"