|
|
---
|
|
|
|
|
|
# Deprecation
|
|
|
# ===========
|
|
|
|
|
|
- name: Drop deprecated directories and files
|
|
|
file:
|
|
|
path: "{{ item }}"
|
|
|
state: absent
|
|
|
with_items:
|
|
|
- "/etc/pip_check_requirements_upgrades-py3"
|
|
|
- "/var/lib/pipreqcheck/virtualenv-py3"
|
|
|
- "/etc/cron.d/check_pip_requirements-py3"
|
|
|
|
|
|
# Main implementation
|
|
|
# ===================
|
|
|
|
|
|
- name: Enable use of proxy for retrieving system packages via apt
|
|
|
template:
|
|
|
src: "apt_proxy.j2"
|
|
@@ -325,10 +340,8 @@
|
|
|
stat:
|
|
|
path: "{{ item.offending_binary }}"
|
|
|
with_items:
|
|
|
- offending_binary: "/var/lib/pipreqcheck/virtualenv/bin/python3"
|
|
|
- offending_binary: "/var/lib/pipreqcheck/virtualenv/bin/python2"
|
|
|
virtualenv_directory: "/var/lib/pipreqcheck/virtualenv"
|
|
|
- offending_binary: "/var/lib/pipreqcheck/virtualenv-py3/bin/python2"
|
|
|
virtualenv_directory: "/var/lib/pipreqcheck/virtualenv-py3"
|
|
|
register: "pipreqcheck_wrong_python_version_check"
|
|
|
|
|
|
- name: Drop Python virtual environment if wrong Python version has been detected within
|
|
@@ -346,8 +359,8 @@
|
|
|
group: pipreqcheck
|
|
|
mode: 0750
|
|
|
with_items:
|
|
|
- "/var/lib/pipreqcheck"
|
|
|
- "/var/lib/pipreqcheck/virtualenv"
|
|
|
- "/var/lib/pipreqcheck/virtualenv-py3"
|
|
|
|
|
|
- name: Create Python virtual environment used for installing/running pip-tools
|
|
|
command: "/usr/bin/virtualenv --python '{{ item.python_path }}' --prompt '({{ item.name }})' '{{ item.virtualenv_path }}'"
|
|
@@ -358,12 +371,8 @@
|
|
|
with_items:
|
|
|
- name: pipreqcheck
|
|
|
virtualenv_path: "/var/lib/pipreqcheck/virtualenv"
|
|
|
python_path: "/usr/bin/python2.7"
|
|
|
creates: "/var/lib/pipreqcheck/virtualenv/bin/python2.7"
|
|
|
- name: pipreqcheck-py3
|
|
|
virtualenv_path: "/var/lib/pipreqcheck/virtualenv-py3"
|
|
|
python_path: "/usr/bin/python3"
|
|
|
creates: "/var/lib/pipreqcheck/virtualenv-py3/bin/python3"
|
|
|
creates: "/var/lib/pipreqcheck/virtualenv/bin/python3"
|
|
|
|
|
|
- name: Create directory for storing pip requirements files
|
|
|
file:
|
|
@@ -374,7 +383,6 @@
|
|
|
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:
|
|
@@ -385,7 +393,6 @@
|
|
|
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
|
|
|
template:
|
|
@@ -397,8 +404,6 @@
|
|
|
with_items:
|
|
|
- path: "/etc/pip_check_requirements_upgrades/pipreqcheck/requirements.in"
|
|
|
requirements: "{{ pip_check_requirements_in }}"
|
|
|
- path: "/etc/pip_check_requirements_upgrades-py3/pipreqcheck/requirements.in"
|
|
|
requirements: "{{ pip_check_requirements_py3_in }}"
|
|
|
|
|
|
- name: Deploy requirements file for pipreqcheck virtual environment
|
|
|
template:
|
|
@@ -410,8 +415,6 @@
|
|
|
with_items:
|
|
|
- file: "/etc/pip_check_requirements_upgrades/pipreqcheck/requirements.txt"
|
|
|
requirements: "{{ pip_check_requirements }}"
|
|
|
- file: "/etc/pip_check_requirements_upgrades-py3/pipreqcheck/requirements.txt"
|
|
|
requirements: "{{ pip_check_requirements_py3 }}"
|
|
|
|
|
|
- name: Install requirements in the pipreqcheck virtual environment
|
|
|
pip:
|
|
@@ -422,10 +425,8 @@
|
|
|
with_items:
|
|
|
- virtualenv: "~pipreqcheck/virtualenv"
|
|
|
requirements: "/etc/pip_check_requirements_upgrades/pipreqcheck/requirements.txt"
|
|
|
- virtualenv: "~pipreqcheck/virtualenv-py3"
|
|
|
requirements: "/etc/pip_check_requirements_upgrades-py3/pipreqcheck/requirements.txt"
|
|
|
|
|
|
- name: Synchronise pip-tools virtual environment via deployed requirements file (Python 2)
|
|
|
- name: Synchronise pip-tools virtual environment via deployed requirements file
|
|
|
shell: "source ~pipreqcheck/virtualenv/bin/activate && pip-sync /etc/pip_check_requirements_upgrades/pipreqcheck/requirements.txt"
|
|
|
args:
|
|
|
executable: /bin/bash
|
|
@@ -434,15 +435,6 @@
|
|
|
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"
|
|
@@ -459,14 +451,6 @@
|
|
|
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:
|