2022-11-22 15:04:17 +01:00
|
|
|
---
|
|
|
|
# tasks file for ipfs
|
|
|
|
|
2023-01-13 18:01:41 +01:00
|
|
|
- ansible.builtin.debug:
|
|
|
|
msg: "ENABLED = {{ ipfs_enabled }}; ipfs role; setup the target as IPFS node"
|
|
|
|
|
|
|
|
- when:
|
2022-11-22 15:04:17 +01:00
|
|
|
- 'ipfs_enabled is true'
|
|
|
|
block:
|
|
|
|
- name: Setup ipfs-update
|
2023-01-13 18:01:41 +01:00
|
|
|
when:
|
|
|
|
- 'ipfs_setup is true'
|
|
|
|
- "'global.update_only' not in ansible_run_tags"
|
2022-11-22 15:04:17 +01:00
|
|
|
block:
|
|
|
|
- name: Create ipfs group
|
|
|
|
group:
|
|
|
|
name: "{{ ipfs_group }}"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create ipfs user
|
|
|
|
user:
|
|
|
|
name: "{{ ipfs_user }}"
|
|
|
|
state: present
|
|
|
|
shell: /sbin/nologin
|
|
|
|
group: "{{ ipfs_group }}"
|
|
|
|
|
|
|
|
- name: Create working dir
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: '/mnt/ipfs'
|
|
|
|
state: directory
|
|
|
|
owner: '{{ ipfs_user }}'
|
|
|
|
group: '{{ ipfs_group }}'
|
|
|
|
|
|
|
|
- name: Download ipfs-update for IPFS version control
|
|
|
|
ansible.builtin.unarchive:
|
|
|
|
src: 'https://dist.ipfs.tech/ipfs-update/v{{ ipfs_updater_version }}/ipfs-update_v{{ ipfs_updater_version }}_linux-{{ architecture_mapping[ansible_architecture] }}.tar.gz'
|
|
|
|
dest: /tmp
|
|
|
|
remote_src: yes
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
|
|
|
|
- name: Install ipfs-update
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /tmp/ipfs-update/ipfs-update
|
|
|
|
dest: /usr/local/bin/ipfs-update
|
|
|
|
owner: ipfs
|
|
|
|
group: ipfs
|
|
|
|
mode: '1750'
|
|
|
|
remote_src: yes
|
|
|
|
|
|
|
|
- name: Install ipfs version specified
|
|
|
|
when: 'ipfs_version is defined'
|
|
|
|
become: true
|
|
|
|
become_user: '{{ ipfs_user }}'
|
|
|
|
block:
|
|
|
|
- name: Create directory tree if not exists
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: '~/{{ item.path }}'
|
|
|
|
state: directory
|
|
|
|
mode: '{{ item.mode }}'
|
|
|
|
with_community.general.filetree: '../templates/ipfs/'
|
|
|
|
when: item.state == 'directory'
|
|
|
|
|
|
|
|
- name: Create and copy hardening files
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: '{{ item.src }}'
|
|
|
|
dest: '~/{{ item.path }}'
|
|
|
|
with_community.general.filetree: '../templates/ipfs/'
|
|
|
|
when: item.state == 'file'
|
|
|
|
|
|
|
|
- name: Update ipfs-update version
|
|
|
|
ansible.builtin.shell: PATH=$PATH:$HOME/.local/bin ipfs-update versions
|
|
|
|
|
|
|
|
- name: Install version
|
|
|
|
ansible.builtin.shell: PATH=$PATH:$HOME/.local/bin ipfs-update install {{ ipfs_version }}
|
|
|
|
|
|
|
|
- include_tasks: "install_{{ ansible_service_mgr }}_service.yml"
|
|
|
|
|
2023-01-13 18:01:41 +01:00
|
|
|
- name: Setup IPFS firewall
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: iptables-ipfs
|