2025-09-30 13:27:57 +01:00
|
|
|
---
|
|
|
|
|
- name: Deploy butter site
|
|
|
|
|
hosts: all
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
- name: Install unzip
|
|
|
|
|
apt:
|
|
|
|
|
name:
|
|
|
|
|
- unzip
|
|
|
|
|
state: present
|
|
|
|
|
update_cache: yes
|
|
|
|
|
when: not ( is_vmdb2 | bool )
|
|
|
|
|
|
|
|
|
|
- name: Ensure /etc/resolv.conf contains nameserver 1.1.1.1
|
|
|
|
|
copy:
|
|
|
|
|
dest: /etc/resolv.conf
|
|
|
|
|
content: "nameserver 1.1.1.1\n"
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0644'
|
|
|
|
|
when: is_vmdb2 | bool
|
|
|
|
|
|
|
|
|
|
- name: Ensure /tmp/butter-site is absent
|
|
|
|
|
file:
|
|
|
|
|
path: /tmp/butter-site
|
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
|
|
- name: Ensure /tmp/site.zip is absent
|
|
|
|
|
file:
|
|
|
|
|
path: /tmp/site.zip
|
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
|
|
- name: Download the butter-box UI zip file
|
|
|
|
|
get_url:
|
2026-01-22 16:10:55 +00:00
|
|
|
url: "https://guardianproject.dev/api/packages/butter/generic/butter-kanglam-ui/latest/kanglam-ui.tar.gz"
|
|
|
|
|
dest: /tmp/site.tar.gz
|
2025-09-30 13:27:57 +01:00
|
|
|
mode: '0644'
|
|
|
|
|
|
|
|
|
|
- name: Ensure /tmp/butter-site directory exists
|
|
|
|
|
file:
|
|
|
|
|
path: /tmp/butter-site
|
|
|
|
|
state: directory
|
|
|
|
|
mode: '0755'
|
|
|
|
|
|
2026-01-22 16:10:55 +00:00
|
|
|
- name: Unarchive site.tar.gz to /tmp/butter-site
|
2025-09-30 13:27:57 +01:00
|
|
|
unarchive:
|
2026-01-22 16:10:55 +00:00
|
|
|
src: /tmp/site.tar.gz
|
|
|
|
|
dest: /var/www/html
|
2025-09-30 13:27:57 +01:00
|
|
|
remote_src: yes
|
2026-01-22 16:10:55 +00:00
|
|
|
extra_opts: [--strip-components=1]
|
2025-09-30 13:27:57 +01:00
|
|
|
|
2026-01-22 16:10:55 +00:00
|
|
|
- name: Set permissions for /var/www/html/
|
|
|
|
|
become: true
|
|
|
|
|
file:
|
|
|
|
|
path: /var/www/html/
|
2025-09-30 13:27:57 +01:00
|
|
|
owner: www-data
|
|
|
|
|
group: www-data
|
|
|
|
|
mode: '0755'
|
2026-01-22 16:10:55 +00:00
|
|
|
recurse: yes
|
|
|
|
|
|
|
|
|
|
# - name: List files in remote directory
|
|
|
|
|
# ansible.builtin.find:
|
|
|
|
|
# paths: /var/www/html
|
|
|
|
|
# file_type: any
|
|
|
|
|
# register: dir_contents
|
|
|
|
|
#
|
|
|
|
|
# - name: Print directory contents
|
|
|
|
|
# ansible.builtin.debug:
|
|
|
|
|
# msg: "{{ dir_contents.files | map(attribute='path') | list }}"
|