|
@@ -298,18 +298,24 @@
|
|
|
|
|
|
- name: Create directory for Python virtual environment used for installing/running pip-tools
|
|
|
file:
|
|
|
path: "/var/lib/pipreqcheck/virtualenv"
|
|
|
path: "{{ item }}"
|
|
|
state: directory
|
|
|
owner: pipreqcheck
|
|
|
group: pipreqcheck
|
|
|
mode: 0750
|
|
|
with_items:
|
|
|
- "/var/lib/pipreqcheck/virtualenv"
|
|
|
- "/var/lib/pipreqcheck/virtualenv-py3"
|
|
|
|
|
|
- name: Create Python virtual environment used for installing/running pip-tools
|
|
|
command: "/usr/bin/virtualenv --prompt '(pipreqcheck)' '/var/lib/pipreqcheck/virtualenv'"
|
|
|
command: "/usr/bin/virtualenv --prompt '({{ item.key }})' '{{ item.value }}'"
|
|
|
args:
|
|
|
creates: '/var/lib/pipreqcheck/virtualenv/bin/activate'
|
|
|
become: true
|
|
|
become_user: "pipreqcheck"
|
|
|
with_dict:
|
|
|
pipreqcheck: "/var/lib/pipreqcheck/virtualenv"
|
|
|
pipreqcheck-py3: "/var/lib/pipreqcheck/virtualenv-py3"
|
|
|
tags:
|
|
|
# [ANSIBLE0012] Commands should not change things if nothing needs doing
|
|
|
# Command will not run if the virtualenv has already been created,
|
|
@@ -318,53 +324,71 @@
|
|
|
|
|
|
- name: Create directory for storing pip requirements files
|
|
|
file:
|
|
|
path: "/etc/pip_check_requirements_upgrades"
|
|
|
path: "{{ item }}"
|
|
|
state: "directory"
|
|
|
owner: root
|
|
|
group: pipreqcheck
|
|
|
mode: 0750
|
|
|
with_items:
|
|
|
- "/etc/pip_check_requirements_upgrades"
|
|
|
- "/etc/pip_check_requirements_upgrades-py3"
|
|
|
|
|
|
- name: Set-up directory for storing pip requirements file for pip-tools virtual environment itself
|
|
|
file:
|
|
|
path: "/etc/pip_check_requirements_upgrades/pipreqcheck"
|
|
|
path: "{{ item }}"
|
|
|
state: "directory"
|
|
|
owner: root
|
|
|
group: pipreqcheck
|
|
|
mode: 0750
|
|
|
with_items:
|
|
|
- "/etc/pip_check_requirements_upgrades/pipreqcheck"
|
|
|
- "/etc/pip_check_requirements_upgrades-py3/pipreqcheck"
|
|
|
|
|
|
- name: Deploy .in file for pip requirements in pip-tools virtual environment
|
|
|
copy:
|
|
|
src: "pipreqcheck_requirements.in"
|
|
|
dest: "/etc/pip_check_requirements_upgrades/pipreqcheck/requirements.in"
|
|
|
dest: "{{ item }}"
|
|
|
owner: root
|
|
|
group: pipreqcheck
|
|
|
mode: 0640
|
|
|
with_items:
|
|
|
- "/etc/pip_check_requirements_upgrades/pipreqcheck/requirements.in"
|
|
|
- "/etc/pip_check_requirements_upgrades-py3/pipreqcheck/requirements.in"
|
|
|
|
|
|
- name: Deploy requirements file for pipreqcheck virtual environment
|
|
|
template:
|
|
|
src: "pipreqcheck_requirements.txt.j2"
|
|
|
dest: "/etc/pip_check_requirements_upgrades/pipreqcheck/requirements.txt"
|
|
|
dest: "{{ item }}"
|
|
|
owner: root
|
|
|
group: pipreqcheck
|
|
|
mode: 0640
|
|
|
with_items:
|
|
|
- "/etc/pip_check_requirements_upgrades/pipreqcheck/requirements.txt"
|
|
|
- "/etc/pip_check_requirements_upgrades-py3/pipreqcheck/requirements.txt"
|
|
|
|
|
|
- name: Install latest pip in pip-tools virtual environment
|
|
|
pip:
|
|
|
name:
|
|
|
- "pip>=9.0.0,<10.0.0"
|
|
|
virtualenv: "~pipreqcheck/virtualenv"
|
|
|
- "pip>=18.0.0,<19.0.0"
|
|
|
virtualenv: "{{ item }}"
|
|
|
become: true
|
|
|
become_user: "pipreqcheck"
|
|
|
with_items:
|
|
|
- "~pipreqcheck/virtualenv"
|
|
|
- "~pipreqcheck/virtualenv-py3"
|
|
|
|
|
|
- name: Install pip-tools if not present
|
|
|
pip:
|
|
|
name: pip-tools
|
|
|
state: present
|
|
|
virtualenv: "~pipreqcheck/virtualenv"
|
|
|
virtualenv: "{{ item }}"
|
|
|
become: true
|
|
|
become_user: "pipreqcheck"
|
|
|
with_items:
|
|
|
- "~pipreqcheck/virtualenv"
|
|
|
- "~pipreqcheck/virtualenv-py3"
|
|
|
|
|
|
- name: Synchronise pip-tools virtual environment via deployed requirements file
|
|
|
- name: Synchronise pip-tools virtual environment via deployed requirements file (Python 2)
|
|
|
shell: "source ~pipreqcheck/virtualenv/bin/activate && pip-sync /etc/pip_check_requirements_upgrades/pipreqcheck/requirements.txt"
|
|
|
args:
|
|
|
executable: /bin/bash
|
|
@@ -373,6 +397,15 @@
|
|
|
register: pipreqcheck_pip_sync
|
|
|
changed_when: "pipreqcheck_pip_sync.stdout != 'Everything up-to-date'"
|
|
|
|
|
|
- name: Synchronise pip-tools virtual environment via deployed requirements file (Python 3)
|
|
|
shell: "source ~pipreqcheck/virtualenv-py3/bin/activate && pip-sync /etc/pip_check_requirements_upgrades-py3/pipreqcheck/requirements.txt"
|
|
|
args:
|
|
|
executable: /bin/bash
|
|
|
become: true
|
|
|
become_user: "pipreqcheck"
|
|
|
register: pipreqcheck_pip_sync
|
|
|
changed_when: "pipreqcheck_pip_sync.stdout != 'Everything up-to-date'"
|
|
|
|
|
|
- name: Deploy script for checking available upgrades
|
|
|
copy:
|
|
|
src: "pip_check_requirements_upgrades.sh"
|
|
@@ -389,6 +422,14 @@
|
|
|
group: root
|
|
|
mode: 0644
|
|
|
|
|
|
- name: Deploy crontab entry for checking pip requirements
|
|
|
copy:
|
|
|
src: "cron_check_pip_requirements-py3"
|
|
|
dest: "/etc/cron.d/check_pip_requirements-py3"
|
|
|
owner: root
|
|
|
group: root
|
|
|
mode: 0644
|
|
|
|
|
|
- name: Install NTP packages
|
|
|
apt:
|
|
|
name:
|