You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
2.4 KiB

  1. ---
  2. - name: update apt
  3. apt: >
  4. update_cache=yes
  5. cache_valid_time=3600
  6. when: ansible_os_family == "Debian"
  7. - name: install deps (Ubuntu)
  8. apt: >
  9. pkg={{item}}
  10. state=installed
  11. with_items:
  12. - unzip
  13. - jq
  14. when: ansible_os_family == "Debian"
  15. - name: install deps (RHEL)
  16. yum: >
  17. pkg={{item}}
  18. state=installed
  19. with_items:
  20. - unzip
  21. - jq
  22. when: ansible_os_family == "RedHat"
  23. - name: create group
  24. group: >
  25. name={{tendermint_group}}
  26. state=present
  27. system=yes
  28. register: tendermint_group_created
  29. - name: create user
  30. user: >
  31. home={{tendermint_home}}
  32. name={{tendermint_user}}
  33. group={{tendermint_group}}
  34. system=yes
  35. when: tendermint_group_created|changed
  36. - name: create directory
  37. file: >
  38. path={{tendermint_home}}
  39. state=directory
  40. owner={{tendermint_user}}
  41. group={{tendermint_group}}
  42. mode=0755
  43. # Check before creating log dir to prevent aggressively overwriting permissions
  44. - name: check for log directory
  45. stat: >
  46. path={{ tendermint_log_file|dirname }}
  47. register: logdir
  48. - name: create log directory if it does not exist
  49. file: >
  50. state=directory
  51. path={{ tendermint_log_file|dirname }}
  52. owner={{ tendermint_user }}
  53. group={{ tendermint_group }}
  54. when: not logdir.stat.exists
  55. - name: touch the log file
  56. file: >
  57. state=touch
  58. path={{ tendermint_log_file }}
  59. owner={{ tendermint_user }}
  60. group={{ tendermint_group }}
  61. changed_when: false
  62. - name: copy and unpack binary
  63. unarchive: >
  64. src={{tendermint_download}}
  65. dest=/usr/local/bin
  66. remote_src=true
  67. mode=0755
  68. creates=/usr/local/bin/tendermint
  69. - name: generate private validator
  70. shell: tendermint gen_validator >> priv_validator.json
  71. args:
  72. chdir: "{{tendermint_home}}"
  73. creates: priv_validator.json
  74. - name: copy config
  75. template: >
  76. src=config.toml.j2
  77. dest={{tendermint_home}}/config.toml
  78. owner={{tendermint_user}}
  79. group={{tendermint_group}}
  80. mode=0644
  81. register: config_was_copied
  82. # notify: restart tendermint
  83. - name: set ownership
  84. file: >
  85. state=directory
  86. path={{tendermint_home}}
  87. owner={{tendermint_user}}
  88. group={{tendermint_group}}
  89. recurse=yes
  90. when: config_was_copied|changed
  91. - name: copy upstart script
  92. template: >
  93. src=tendermint.conf.j2
  94. dest=/etc/init/tendermint.conf
  95. owner=root
  96. group=root
  97. mode=0644
  98. # notify: restart tendermint