node/conf/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 27 Apr 2020 11:17:52 -0500
changeset 0 474ccafc2349
child 2 0556e208fbee
permissions -rw-r--r--
Initial commit of btcd and lnd roles.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: create node data dir
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  file:
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
    path: "{{item}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
    state: "directory"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
    owner: "{{node_user}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
    group: "{{node_user}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    mode: "0770"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
  with_items:
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
    - "{{node_data_dir}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
    - "{{node_log_dir}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
    - "{{node_conf_dir}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
- name: install conf
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
  become: yes
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
  template:
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    src: "{{node_conf_template}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    dest: "{{node_conf_dir}}/{{node_type}}.conf"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
    owner: "{{node_user}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
    group: "{{node_user}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
    mode: "0770"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
  notify: restart node
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
- name: install node service
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
  become: yes
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
  template:
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
    src: "{{node_service_template}}"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
    dest: "/lib/systemd/system/{{node_type}}.service"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
    mode: "0644"
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
  notify: restart node
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
- name: ensure node is started
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
  become: yes
474ccafc2349 Initial commit of btcd and lnd roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
  systemd: service="{{node_type}}.service" enabled="yes" state="started" daemon_reload="yes"