diff --git a/.gitignore b/.gitignore index 4b000a64..083c5432 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,5 @@ faucet.yml reverse_proxy.yml dshackle.yml .vscode/settings.json +enodes.json diff --git a/playbooks/tasks/collect_enodes.yml b/playbooks/tasks/collect_enodes.yml new file mode 100644 index 00000000..f1bb5fe3 --- /dev/null +++ b/playbooks/tasks/collect_enodes.yml @@ -0,0 +1,23 @@ +- name: Collect enodes + hosts: execution + gather_facts: false + serial: 20 + tasks: + - name: Get enode from logs + shell: docker logs {{execution_container_name}} | grep enode:// | sed 's/.*enode:\/\///' + register: enode_noprefix_cmd + - name: Set each node's own enode + set_fact: + execution_enode: "enode://{{enode_noprefix_cmd.stdout}}" +- name: Write enodes + hosts: localhost + gather_facts: true + tasks: + - name: Create a map with all node's enodes + with_items: "{{ groups['execution'] }}" + set_fact: + execution_enodes: "{{ execution_enodes|default({}) | combine( {item: hostvars[item]['execution_enode']} ) }}" + - name: Write enodes + copy: + content: "{{ execution_enodes.values() | list | to_nice_json }}" + dest: "../../enodes.json"