Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy fastpath #380

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions ansible/deploy-fastpath.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- import_playbook: ansible-version.yml

- hosts: fastpath.ooni.nu
roles:
- role: fastpath
44 changes: 44 additions & 0 deletions ansible/roles/fastpath/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---

# Deploy the fastpath
#
# Deploy .deb package to the fastpath host
#
# Fetch SSH pubkey and deploy it on the collector hosts
#
# Set the hostname of the collectors in the fastpath config file

# Usage: place the .deb file in files/
# update the version number as needed

#- name: pull fastpath .deb package
# copy:
# src: files/fastpath_0.1_all.deb
# dest: /root/
# owner: root
# group: root
# mode: '0644'

#- name: install .deb using dpkg
# apt:
# deb: '{{ item }}'
# state: present
# with_items:
# - /root/fastpath_0.1_all.deb

- name: generate fastpath.conf file with active collectors names in it
template:
owner: "root"
group: "root"
mode: '0644'
src: "fastpath.conf.j2"
dest: "/etc/fastpath.conf"

- name: fill active collectors SSH pubkeys into fastpath's known_hosts
template:
owner: "fastpath"
group: "fastpath"
mode: '0644'
src: "known_collectors"
dest: /var/lib/fastpath/ssh/known_hosts

7 changes: 7 additions & 0 deletions ansible/roles/fastpath/templates/fastpath.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Deployed by https://github.com/ooni/sysadmin/blob/master/ansible/roles/fastpath
# deploy-fastpath.yml
# roles/fastpath/tasks/main.yml
# roles/fastpath/templates/fastpath.conf.j2

[DEFAULT]
collectors = {{ groups['active_collector'] | join(' ') }}
4 changes: 4 additions & 0 deletions ansible/roles/fastpath/templates/known_collectors
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Deployed by https://github.com/ooni/sysadmin/blob/master/ansible/roles/fastpath/templates/known_collectors
{% for host in groups.active_collector %}
{{ lookup('pipe', 'grep -F -e {}, {}/../ext/known_hosts'.format(host, inventory_dir)) }}
{% endfor %}
2 changes: 1 addition & 1 deletion ansible/roles/ooni-collector/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ collector_tag: '20190221-0980b82a'
collector_data_dir: '{{ CHANGE_ME }}' # it varies across collectors
collector_domain: '{{ CHANGE_ME }}'
with_nginx: yes
sshfeeder_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID3MZP0tYUzaZOZa8JhRIx3PiTXwXfwQdTPa/RwDmwcA"
sshfeeder_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHAxyZVlDHc50fim5qWkf+yQhVpVR6d4btNBE8xb4XCd fastpath"
...
4 changes: 4 additions & 0 deletions ansible/roles/ooni-collector/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,18 @@
- name: Setup the sshfeeder account
user:
name: sshfeeder
group: sshfeeder
groups: "{{ collector_user }}"
createhome: yes
append: yes
shell: /bin/bash
home: "/home/sshfeeder"
system: no
tags: collector_ssh

- name: Set authorized key for sshfeeder
authorized_key:
user: sshfeeder
state: present
key: "{{ sshfeeder_key }}"
tags: collector_ssh