fp/ansible/roles/ipfs/tasks/config.yml
CJ_Clippy 325fe576e2
Some checks failed
ci / test (push) Failing after 6m3s
fp/our CI/CD / build (push) Successful in 1m27s
add ipfs playbook
2025-10-04 08:45:34 -08:00

57 lines
1.8 KiB
YAML

---
- name: Load IPFS config from remote
ansible.builtin.slurp:
src: "{{ ipfs_path }}/config"
register: ipfs_config_raw
- name: Parse IPFS config JSON
ansible.builtin.set_fact:
ipfs_config: "{{ ipfs_config_raw.content | b64decode | from_json }}"
# - name: Debug IPFS config
# ansible.builtin.debug:
# var: ipfs_config
- name: Show storagemax variable
ansible.builtin.debug:
msg: " here is what we ahvea configured for ipfs_storage_max:{{ ipfs_storage_max }}"
- name: Show storagemax before
ansible.builtin.debug:
msg: "here is the storagemax before: {{ ipfs_config.Datastore.StorageMax }}"
# noqa command-instead-of-shell
- name: Configure IPFS Provide.DHT.SweepEnabled
ansible.builtin.shell:
cmd: "env IPFS_PATH={{ ipfs_path }} /usr/local/bin/ipfs config --json Provide.DHT.SweepEnabled true"
when: ipfs_config.Provide.DHT.SweepEnabled is not defined or not true
changed_when: true # explicitly mark it as a change when it runs
notify:
- Restart ipfs
become: true
become_user: ipfs
# noqa command-instead-of-shell
- name: Configure IPFS Datastore.StorageMax
ansible.builtin.shell:
cmd: "env IPFS_PATH={{ ipfs_path }} /usr/local/bin/ipfs config Datastore.StorageMax {{ ipfs_storage_max }}"
when: ipfs_config.Datastore.StorageMax is not defined or ipfs_config.Datastore.StorageMax != ipfs_storage_max
changed_when: true
notify:
- Restart ipfs
become: true
become_user: ipfs
- name: Load IPFS config from remote
ansible.builtin.slurp:
src: "{{ ipfs_path }}/config"
register: ipfs_config_raw_after
- name: Parse IPFS config JSON after making changes
ansible.builtin.set_fact:
ipfs_config_after: "{{ ipfs_config_raw_after.content | b64decode | from_json }}"
- name: Blah
ansible.builtin.debug:
msg: "here is the storagemax after: {{ ipfs_config_after.Datastore.StorageMax }}"