diff --git a/testsite/playbooks/roles/wsgihello2/tasks/main.yml b/testsite/playbooks/roles/wsgihello2/tasks/main.yml index 8fed7495cb887880b46857e71d5304cd73c245de..41247c553e99c73ef4094f08d59428c930205dbc 100644 --- a/testsite/playbooks/roles/wsgihello2/tasks/main.yml +++ b/testsite/playbooks/roles/wsgihello2/tasks/main.yml @@ -1,38 +1,55 @@ --- - name: Create directory for storing code - file: dest="/var/www/wsgireq.{{ testsite_domain }}/code/" state=directory - owner="admin-wsgireq_{{ testsite_domain_underscores }}" group="web-wsgireq_{{ testsite_domain_underscores }}" mode=2750 + ansible.builtin.file: + dest: "/var/www/wsgireq.{{ testsite_domain }}/code/" + state: directory + owner: "admin-wsgireq_{{ testsite_domain_underscores }}" + group: "web-wsgireq_{{ testsite_domain_underscores }}" + mode: "02750" - name: Deploy requirements and its source for upgrade checks - copy: src="{{ item }}" dest="/etc/pip_check_requirements_upgrades/wsgireq.{{ testsite_domain }}/{{ item }}" - owner="root" group="pipreqcheck" mode=640 + ansible.builtin.copy: + src: "{{ item }}" + dest: "/etc/pip_check_requirements_upgrades/wsgireq.{{ testsite_domain }}/{{ item }}" + owner: "root" + group: "pipreqcheck" + mode: "0640" with_items: - requirements.in - requirements.txt - name: Deploy requirements - copy: src="requirements.txt" dest="/var/www/wsgireq.{{ testsite_domain }}/code/requirements.txt" - owner="admin-wsgireq_{{ testsite_domain_underscores }}" group="web-wsgireq_{{ testsite_domain_underscores }}" mode=640 - -- name: Install latest version of pip - become_user: "admin-wsgireq_{{ testsite_domain_underscores }}" - pip: name=pip state=latest virtualenv="/var/www/wsgireq.{{ testsite_domain }}/virtualenv" + ansible.builtin.copy: + src: "requirements.txt" + dest: "/var/www/wsgireq.{{ testsite_domain }}/code/requirements.txt" + owner: "admin-wsgireq_{{ testsite_domain_underscores }}" + group: "web-wsgireq_{{ testsite_domain_underscores }}" + mode: "0640" - name: Deploy pip-tools + become: true become_user: "admin-wsgireq_{{ testsite_domain_underscores }}" - pip: name=pip-tools state=present virtualenv="/var/www/wsgireq.{{ testsite_domain }}/virtualenv" + ansible.builtin.pip: + name: pip-tools + state: present + virtualenv: "/var/www/wsgireq.{{ testsite_domain }}/virtualenv" - name: Synchronise virtual environment with requirements file + become: true become_user: "admin-wsgireq_{{ testsite_domain_underscores }}" - command: "'/var/www/wsgireq.{{ testsite_domain }}/virtualenv/bin/exec' pip-sync ~/code/requirements.txt ~/.wsgi_requirements.txt" + ansible.builtin.command: "'/var/www/wsgireq.{{ testsite_domain }}/virtualenv/bin/exec' pip-sync ~/code/requirements.txt ~/.wsgi_requirements.txt" register: pip_sync_result changed_when: "pip_sync_result.stdout != 'Everything up-to-date'" notify: - Restart wsgihello2 - name: Deploy WSGI application - copy: src="hello.wsgi" dest="/var/www/wsgireq.{{ testsite_domain }}/code/wsgi.py" - owner="admin-wsgireq_{{ testsite_domain_underscores }}" group="web-wsgireq_{{ testsite_domain_underscores }}" mode=640 + ansible.builtin.copy: + src: "hello.wsgi" + dest: "/var/www/wsgireq.{{ testsite_domain }}/code/wsgi.py" + owner: "admin-wsgireq_{{ testsite_domain_underscores }}" + group: "web-wsgireq_{{ testsite_domain_underscores }}" + mode: "0640" notify: - Restart wsgihello2