Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
---
# handlers file for snowflake
- name: restart snowflake
ansible.builtin.service:
name: snowflake-proxy
state: restarted
58 changes: 0 additions & 58 deletions tasks/arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,3 @@
package:
name: "{{ snowflake_utils_arch }}"
state: present

- name: Add the user
ansible.builtin.user:
name: "{{ snowflake_user }}"
create_home: true
state: present

- name: Clone snowflake repo
ansible.builtin.git:
repo: 'https://git.torproject.org/pluggable-transports/snowflake.git'
dest: /home/{{ snowflake_user }}/repo
update: "{{ snowflake_update }}"
register: clone_git

- name: go get
command: go get
args:
warn: no
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_get
when: clone_git is changed

- name: go build
command: go build
args:
warn: no
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_build
when: clone_git is changed

- name: Copy binary file to /usr/bin/
ansible.builtin.copy:
src: /home/{{ snowflake_user }}/repo/proxy/proxy
dest: /usr/bin/
mode: a+x
remote_src: yes

- name: Add unit systemd
template:
src: "../templates/{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: 0644
with_items:
- snowflake-proxy.service

- name: Enable service snowflake-proxy
ansible.builtin.systemd:
name: snowflake-proxy
enabled: yes

- name: Just force systemd to reread configs
ansible.builtin.systemd:
daemon_reload: yes

- name: Start/restart service snowflake
ansible.builtin.service:
name: snowflake-proxy
state: restarted
64 changes: 6 additions & 58 deletions tasks/debian-bullseye.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
- name: Update cache
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 3600

- name: Install golang
package:
name: "{{ snowflake_packages_deb }}"
Expand All @@ -8,61 +14,3 @@
package:
name: "{{ snowflake_utils }}"
state: present

- name: Add the user
ansible.builtin.user:
name: "{{ snowflake_user }}"
create_home: true
state: present

- name: Clone snowflake repo
ansible.builtin.git:
repo: 'https://git.torproject.org/pluggable-transports/snowflake.git'
dest: /home/{{ snowflake_user }}/repo
update: "{{ snowflake_update }}"
register: clone_git

- name: go get
command: go get
args:
warn: no
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_get
when: clone_git is changed

- name: go build
command: go build
args:
warn: no
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_build
when: clone_git is changed

- name: Copy binary file to /usr/bin/
ansible.builtin.copy:
src: /home/{{ snowflake_user }}/repo/proxy/proxy
dest: /usr/bin/
mode: a+x
remote_src: yes

- name: Add unit systemd
template:
src: "../templates/{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: 0644
with_items:
- snowflake-proxy.service

- name: Enable service snowflake-proxy
ansible.builtin.systemd:
name: snowflake-proxy
enabled: yes

- name: Just force systemd to reread configs
ansible.builtin.systemd:
daemon_reload: yes

- name: Start/restart service snowflake
ansible.builtin.service:
name: snowflake-proxy
state: restarted
65 changes: 6 additions & 59 deletions tasks/debian.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
- name: Update cache
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 3600

- name: Add backports repository
apt_repository:
repo: "deb http://deb.debian.org/debian buster-backports main"
Expand All @@ -14,62 +20,3 @@
package:
name: "{{ snowflake_utils }}"
state: present

- name: Add the user
ansible.builtin.user:
name: "{{ snowflake_user }}"
create_home: true
state: present

- name: Clone snowflake repo
ansible.builtin.git:
repo: 'https://git.torproject.org/pluggable-transports/snowflake.git'
dest: /home/{{ snowflake_user }}/repo
update: "{{ snowflake_update }}"
register: clone_git

- name: go get
command: go get
args:
warn: no
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_get
when: clone_git is changed

- name: go build
command: go build
args:
warn: no
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_build
when: clone_git is changed

- name: Copy binary file to /usr/bin/
ansible.builtin.copy:
src: /home/{{ snowflake_user }}/repo/proxy/proxy
dest: /usr/bin/
mode: a+x
remote_src: yes

- name: Add unit systemd
template:
src: "../templates/{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: 0644
with_items:
- snowflake-proxy.service

- name: Enable service snowflake-proxy
ansible.builtin.systemd:
name: snowflake-proxy
enabled: yes

- name: Just force systemd to reread configs
ansible.builtin.systemd:
daemon_reload: yes

- name: Start/restart service snowflake
ansible.builtin.service:
name: snowflake-proxy
state: restarted

59 changes: 0 additions & 59 deletions tasks/fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,3 @@
package:
name: "{{ snowflake_utils_fedora }}"
state: present

- name: Add the user
ansible.builtin.user:
name: "{{ snowflake_user }}"
create_home: true
state: present

- name: Clone snowflake repo
ansible.builtin.git:
repo: 'https://git.torproject.org/pluggable-transports/snowflake.git'
dest: /home/{{ snowflake_user }}/repo
update: "{{ snowflake_update }}"
register: clone_git

- name: go get
command: go get
args:
warn: no
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_get
when: clone_git is changed

- name: go build
command: go build
args:
warn: no
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_build
when: clone_git is changed

- name: Copy binary file to /usr/bin/
ansible.builtin.copy:
src: /home/{{ snowflake_user }}/repo/proxy/proxy
dest: /usr/bin/
mode: a+x
remote_src: yes

- name: Add unit systemd
template:
src: "../templates/{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: 0644
with_items:
- snowflake-proxy.service

- name: Enable service snowflake-proxy
ansible.builtin.systemd:
name: snowflake-proxy
enabled: yes


- name: Just force systemd to reread configs
ansible.builtin.systemd:
daemon_reload: yes

- name: Start/restart service snowflake
ansible.builtin.service:
name: snowflake-proxy
state: restarted
55 changes: 55 additions & 0 deletions tasks/linux-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
- name: Add the user
ansible.builtin.user:
name: "{{ snowflake_user }}"
create_home: true
state: present

- name: Clone snowflake repo
ansible.builtin.git:
repo: 'https://git.torproject.org/pluggable-transports/snowflake.git'
dest: /home/{{ snowflake_user }}/repo
update: "{{ snowflake_update }}"
register: clone_git

- name: go get
command: go get
args:
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_get
when: clone_git is changed

- name: go build
command: go build
args:
chdir: /home/{{ snowflake_user }}/repo/proxy
register: go_build
when: clone_git is changed

- name: Copy binary file to /usr/bin/
ansible.builtin.copy:
src: /home/{{ snowflake_user }}/repo/proxy/proxy
dest: /usr/bin/
mode: a+x
remote_src: yes
notify: restart snowflake

- name: Add unit systemd
template:
src: "../templates/{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: 0644
with_items:
- snowflake-proxy.service
notify: restart snowflake

- name: Enable service snowflake-proxy
ansible.builtin.systemd:
name: snowflake-proxy
enabled: yes
state: started

- name: Just force systemd to reread configs
ansible.builtin.systemd:
daemon_reload: yes

14 changes: 9 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@
- ansible_distribution == 'Ubuntu'
- ansible_distribution_release == 'focal' or ansible_distribution_release == 'jammy'

- include_tasks: freebsd.yml
when:
- ansible_distribution == 'FreeBSD'
- ansible_distribution_release == '13.0-RELEASE'

- include_tasks: arch.yml
when:
- ansible_distribution == 'Archlinux'

- include_tasks: fedora.yml
when: ansible_os_family == 'RedHat'

- include_tasks: linux-common.yml
when: ansible_distribution != 'FreeBSD'


- include_tasks: freebsd.yml
when:
- ansible_distribution == 'FreeBSD'
- ansible_distribution_release == '13.0-RELEASE'
Loading