58 lines
1.8 KiB
YAML
58 lines
1.8 KiB
YAML
|
|
---
|
||
|
|
- name: Assert the daemon RPC credentials are available
|
||
|
|
ansible.builtin.assert:
|
||
|
|
that:
|
||
|
|
- xmrblocks_rpc_user | length > 0
|
||
|
|
- xmrblocks_rpc_password | length > 0
|
||
|
|
quiet: true
|
||
|
|
fail_msg: >-
|
||
|
|
xmrblocks needs monerod's RPC login: --rpc-login guards both of monerod's
|
||
|
|
RPC servers, so without it the mempool view and the pusher get 401.
|
||
|
|
|
||
|
|
- name: Create the xmrblocks systemd unit
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: xmrblocks.service.j2
|
||
|
|
dest: /etc/systemd/system/xmrblocks.service
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0644'
|
||
|
|
# The unit embeds --daemon-login in ExecStart, so --diff would print the
|
||
|
|
# RPC password. -e xmrblocks_reveal_config=true when you need to see it.
|
||
|
|
diff: "{{ xmrblocks_reveal_config | default(false) | bool }}"
|
||
|
|
notify: Restart xmrblocks
|
||
|
|
|
||
|
|
- name: Reload systemd daemon
|
||
|
|
systemd:
|
||
|
|
daemon_reload: yes
|
||
|
|
|
||
|
|
- name: Enable and start xmrblocks
|
||
|
|
systemd:
|
||
|
|
name: xmrblocks
|
||
|
|
enabled: yes
|
||
|
|
state: started
|
||
|
|
|
||
|
|
- name: Flush handlers so xmrblocks is running before we probe it
|
||
|
|
meta: flush_handlers
|
||
|
|
|
||
|
|
# Generous on purpose. xmrblocks opens the whole LMDB before it binds, and this
|
||
|
|
# pool is a spinning-disk mirror - it logs "The blockchain is on a rotating
|
||
|
|
# drive: this will be very slow" and took 98 SECONDS to come up on first start.
|
||
|
|
# 90s was not enough and produced a scary failure on a service that was fine.
|
||
|
|
- name: Wait for the xmrblocks HTTP port
|
||
|
|
ansible.builtin.wait_for:
|
||
|
|
port: "{{ xmrblocks_port }}"
|
||
|
|
host: 127.0.0.1
|
||
|
|
delay: 5
|
||
|
|
timeout: 300
|
||
|
|
ignore_errors: yes
|
||
|
|
|
||
|
|
- name: Check the xmrblocks service status
|
||
|
|
systemd:
|
||
|
|
name: xmrblocks
|
||
|
|
register: xmrblocks_status
|
||
|
|
changed_when: false
|
||
|
|
|
||
|
|
- name: Display the xmrblocks service status
|
||
|
|
ansible.builtin.debug:
|
||
|
|
msg: "xmrblocks is {{ 'running' if xmrblocks_status.status.ActiveState == 'active' else 'NOT running' }}"
|