You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
3.8 KiB
YAML

---
- name: Copy config to home directory
copy:
src: home/
dest: "{{ ansible_facts.env.HOME }}/"
mode: preserve
- name: Create link at ~/web
file:
src: /var/www/virtual/{{ ansible_facts.user_id }}
dest: "{{ ansible_facts.env.HOME }}/web"
state: link
- name: Initialize ~/web/sites
file:
path: /var/www/virtual/{{ ansible_facts.user_id }}/sites
state: directory
- name: Download and update projectr
git:
repo: https://github.com/lukasbestle/projectr.git
dest: "{{ ansible_facts.env.HOME }}/.config/fish/pkgs/projectr"
- name: Set up deploy script
template:
src: deploy.php.j2
dest: /var/www/virtual/{{ ansible_facts.user_id }}/html/deploy.php
- name: Read existing Uberspace domains
command: uberspace web domain list
register: uberspace_web_domain_result
changed_when: no
- name: Add configured domains to Uberspace config
shell: "uberspace web domain add $(idn {{ item.key }})"
when: item.key not in uberspace_web_domain_result.stdout_lines
loop: "{{ web_links.get(ansible_facts.user_id, {}) | dict2items }}"
- name: Set up sites using projectr
command:
argv:
- site_add
- "{{ item.key }}"
creates: /var/www/virtual/{{ ansible_facts.user_id }}/sites/{{ item.key }}
loop: "{{ web_sites.get(ansible_facts.user_id, {}) | dict2items }}"
- name: Set up site origins using projectr (sites with origin)
command:
argv:
- site_origin
- "{{ item.key }}"
- "{{ item.value }}"
creates: /var/www/virtual/{{ ansible_facts.user_id }}/sites/{{ item.key }}/.origin
loop: "{{ web_sites.get(ansible_facts.user_id, {}) | dict2items }}"
when: item.value != None
- name: Set up site origins using projectr (sites without origin)
command:
argv:
- site_origin
- "{{ item.key }}"
removes: /var/www/virtual/{{ ansible_facts.user_id }}/sites/{{ item.key }}/.origin
loop: "{{ web_sites.get(ansible_facts.user_id, {}) | dict2items }}"
when: item.value == None
- name: Deploy sites using projectr (sites with origin)
command:
argv:
- site_deploy
- "{{ item.key }}"
creates: /var/www/virtual/{{ ansible_facts.user_id }}/sites/{{ item.key }}/current
loop: "{{ web_sites.get(ansible_facts.user_id, {}) | dict2items }}"
when: item.value != None
- name: Link sites to domains
command:
argv:
- site_link
- "{{ item.value.site }}"
- "{{ item.key }}"
- "{{ item.value.get('path', '') }}"
creates: /var/www/virtual/{{ ansible_facts.user_id }}/{{ item.key }}
loop: "{{ web_links.get(ansible_facts.user_id, {}) | dict2items }}"
- name: Ensure that qdated directories for all Mail Uberspaces exist
file:
path: "{{ ansible_facts.env.HOME }}/.config/qdated/{{ hostvars[item].ansible_facts.user_id }}"
state: directory
loop: "{{ groups.mail }}"
- name: Copy qdated keys from all Mail Uberspaces
copy:
content: "{{ hostvars[item].qdated_key }}"
dest: "{{ ansible_facts.env.HOME }}/.config/qdated/{{ hostvars[item].ansible_facts.user_id }}/.qdated-key"
loop: "{{ groups.mail }}"
- name: Set up qdated address generation cronjob
cron:
name: "qdated generation"
hour: "2"
minute: "3"
job: "{{ ansible_facts.env.HOME }}/bin/qdated-generate"
- name: Check if the access log is enabled
command: uberspace web log access status
register: uberspace_log_access_status_result
changed_when: no
- name: Enable access log
command: uberspace web log access enable
when: "'is enabled' not in uberspace_log_access_status_result.stdout"
- name: Check if the PHP error log is enabled
command: uberspace web log php_error status
register: uberspace_log_php_error_status_result
changed_when: no
- name: Enable PHP error log
command: uberspace web log php_error enable
when: "'is enabled' not in uberspace_log_php_error_status_result.stdout"