Ansible role that will install (& uninstall), configure and runs Besu: an enterprise Java Ethereum Client
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.
ansible-role-besu/tasks/install.yml

75 lines
2.0 KiB

---
- name: Ensure Besu group exists
group:
name: "{{ besu_group }}"
state: present
become: true
- name: Create Besu user
user:
comment: Besu client user
name: "{{ besu_user }}"
group: "{{ besu_group }}"
become: true
- name: Create base directory
file:
path: "{{ besu_base_dir }}"
state: directory
owner: "{{ besu_user }}"
group: "{{ besu_group }}"
become: true
- name: Create install directory
file:
path: "{{ besu_install_dir }}"
state: directory
owner: "{{ besu_user }}"
group: "{{ besu_group }}"
become: true
- name: Create log directory
file:
path: "{{ besu_log_dir }}"
state: directory
owner: "{{ besu_user }}"
group: "{{ besu_group }}"
become: true
- name: Setup logrotate
template:
src: "logrotate/besu"
dest: "/etc/logrotate.d/besu"
become: true
# besu binary files are hosted in github for any version after 24.1.2
- name: Update besu_download_url to provide support for older versions
set_fact:
besu_download_url: "https://hyperledger.jfrog.io/artifactory/besu-binaries/besu/{{ besu_version }}/besu-{{ besu_version }}.tar.gz"
when: "{{ besu_version is version('24.1.2', operator='le', version_type='semver') | bool == True}}"
- name: Extract Besu source to install directory
unarchive:
src: "{{ '/tmp/besu/build/distributions/besu-' + besu_version + '.tar.gz' if besu_build_from_source else besu_download_url }}"
remote_src: "{{ false if besu_build_from_source else true }}"
dest: "{{ besu_install_dir }}"
owner: "{{ besu_user }}"
group: "{{ besu_group }}"
mode: '0775'
extra_opts:
- --strip-components
- '1'
become: true
- name: Create a symlink to current
file:
src: "{{ besu_install_dir }}/"
dest: "{{ besu_current_dir }}"
state: link
become: true
register: link_current
- name: Set updated optionally to trigger a systemd restart at the end
set_fact:
besu_state_updates: "{{ besu_state_updates + ['besu.install_dir'] }}"
when: link_current is changed