blob: f385213380fea1d56817f6bccf4f73aa06bdf8aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
---
- name: "make build directory"
delegate_to: localhost
ansible.builtin.file:
path: "{{ item }}"
state: directory
loop:
- "{{ inventory_dir }}/.hugo_sites_build"
- "{{ inventory_dir }}/.built_sites"
- name: "copy specific folders to hugo_tmp for each user"
delegate_to: localhost
ansible.builtin.shell: "rsync -avz {{ inventory_dir }}/web/ {{ inventory_dir }}/.hugo_sites_build/{{ item }} {{ '--exclude=anyconnect.md' if 'ocserv' not in user_pass_dict[item] }} {{'--exclude=openconnect.md' if 'ocserv' not in user_pass_dict[item] }} {{'--exclude=nekobox.md' if ['trojan','vmess','vless']|intersect(user_pass_dict[item]) == {} }} {{'--exclude=nekoray.md' if ['trojan','vmess','vless']|intersect(user_pass_dict[item]) == {} }} {{'--exclude=nekossh.md' if 'sshvpn' not in user_pass_dict[item] }}"
loop: "{{ user_pass_dict.keys() }}"
- name: "template out hugo.toml"
delegate_to: localhost
ansible.builtin.template:
src: "{{ inventory_dir }}/.hugo_sites_build/{{ item }}/hugo.toml.j2"
dest: "{{ inventory_dir }}/.hugo_sites_build/{{ item }}/hugo.toml"
loop: "{{ user_pass_dict.keys() }}"
- name: "template out vars"
ansible.builtin.include_tasks: template_vars.yaml
loop:
- content.en
- content.fa
loop_control:
loop_var: content_dir
- name: "copy hugo_build.sh to temp dir"
delegate_to: localhost
ansible.builtin.copy:
src: "{{ inventory_dir }}/utils/hugo_build.sh"
dest: ".hugo_sites_build/hugo_build.sh"
- name: "build hugo sites"
delegate_to: localhost
ansible.builtin.shell: "sh {{ inventory_dir }}/.hugo_sites_build/hugo_build.sh"
- name: "copy sites"
ansible.posix.synchronize:
src: "{{ inventory_dir }}/.built_sites/" # this will only copy contents
dest: /var/www/reactance
- name: "copy images"
ansible.posix.synchronize:
src: "{{ inventory_dir }}/web/static/images/"
dest: /var/www/reactance/images
- name: "charge dir permissions"
ansible.builtin.file:
dest: /var/www/reactance
owner: www
group: daemon
mode: 0755
recurse: yes
- name: "remove build directory"
delegate_to: localhost
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- "{{ inventory_dir }}/.hugo_sites_build"
- "{{ inventory_dir }}/.built_sites"
|