2023-03-27 16:24:16 +00:00
|
|
|
---
|
2023-04-07 16:19:36 +00:00
|
|
|
- name: Task name
|
|
|
|
stat:
|
|
|
|
path: /var/www/{{ vhost_name }}
|
|
|
|
register: project_dir
|
|
|
|
|
2023-04-07 16:22:32 +00:00
|
|
|
- name: Create wwwroot
|
|
|
|
file:
|
|
|
|
path: /var/www/{{ vhost_name }}
|
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
|
|
|
when: not project_dir.stat.exists
|
|
|
|
|
2023-03-27 16:24:16 +00:00
|
|
|
- name: Download latest WP
|
|
|
|
get_url:
|
|
|
|
url: https://wordpress.org/latest.zip
|
2023-03-28 08:24:45 +00:00
|
|
|
dest: /tmp/latest.zip
|
2023-03-27 16:24:16 +00:00
|
|
|
mode: '0660'
|
2023-04-07 16:19:36 +00:00
|
|
|
when: not project_dir.stat.exists
|
|
|
|
|
2023-03-27 16:24:16 +00:00
|
|
|
- name: Extract wordpress
|
|
|
|
unarchive:
|
2023-03-28 08:24:45 +00:00
|
|
|
src: /tmp/latest.zip
|
|
|
|
dest: /var/www/
|
2023-03-27 16:24:16 +00:00
|
|
|
remote_src: yes
|
2023-04-07 16:19:36 +00:00
|
|
|
when: not project_dir.stat.exists
|
2023-03-27 16:24:16 +00:00
|
|
|
|
|
|
|
- name: Delete the wordpress zip
|
|
|
|
file:
|
|
|
|
state: absent
|
2023-03-28 08:24:45 +00:00
|
|
|
path: /tmp/latest.zip
|
2023-04-07 16:19:36 +00:00
|
|
|
when: not project_dir.stat.exists
|
2023-03-27 16:38:19 +00:00
|
|
|
|
2023-03-28 08:24:45 +00:00
|
|
|
- name: Create wwwroot
|
2023-03-27 16:38:19 +00:00
|
|
|
file:
|
2023-03-28 08:24:45 +00:00
|
|
|
path: /var/www/{{ vhost_name}}
|
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
2023-04-07 16:19:36 +00:00
|
|
|
when: not project_dir.stat.exists
|
2023-03-28 08:24:45 +00:00
|
|
|
|
|
|
|
- name: Rename folder
|
|
|
|
shell: mv /var/www/wordpress/* /var/www/{{ vhost_name }}/
|
2023-04-07 16:19:36 +00:00
|
|
|
when: not project_dir.stat.exists
|
2023-03-28 08:24:45 +00:00
|
|
|
|
|
|
|
- name: Delete old folder
|
|
|
|
file:
|
|
|
|
path: /var/www/wordpress
|
|
|
|
state: absent
|
2023-04-07 16:19:36 +00:00
|
|
|
when: not project_dir.stat.exists
|
2023-03-28 08:24:45 +00:00
|
|
|
|
|
|
|
- name: Chown
|
|
|
|
become: true
|
|
|
|
shell: chown -R www-data:www-data /var/www/{{ vhost_name }}
|
2023-04-07 16:19:36 +00:00
|
|
|
when: not project_dir.stat.exists
|
2023-03-28 08:24:45 +00:00
|
|
|
|
|
|
|
- name: Chmod
|
|
|
|
become: true
|
|
|
|
shell: chmod -R 755 /var/www/{{ vhost_name }}
|
2023-04-07 16:19:36 +00:00
|
|
|
when: not project_dir.stat.exists
|