From 6bfbc0a68a5b23ab477162e21337267841d24781 Mon Sep 17 00:00:00 2001 From: Bryan Black Date: Thu, 27 Oct 2022 21:59:13 -0700 Subject: [PATCH] add ganache fixes to nodejs and yarn. update requirements.yml, add two install methods for ganache, fixes to remix --- ansible/plays/evm-tools.yml | 7 ++++--- ansible/roles/common/tasks/install-node.yml | 12 +++++++++--- ansible/roles/ganache/tasks/install-via-docker.yml | 8 ++++++++ ansible/roles/ganache/tasks/install-via-npm.yml | 7 +++++++ ansible/roles/ganache/tasks/main.yml | 7 +++++++ ansible/roles/remix/tasks/main.yml | 9 +++++++++ ansible/roles/requirements.yml | 5 ++--- ansible/roles/truffle/tasks/main.yml | 7 +++++++ 8 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 ansible/roles/ganache/tasks/install-via-docker.yml create mode 100644 ansible/roles/ganache/tasks/install-via-npm.yml create mode 100644 ansible/roles/ganache/tasks/main.yml create mode 100644 ansible/roles/remix/tasks/main.yml diff --git a/ansible/plays/evm-tools.yml b/ansible/plays/evm-tools.yml index a72c23e..9e6ea52 100644 --- a/ansible/plays/evm-tools.yml +++ b/ansible/plays/evm-tools.yml @@ -1,11 +1,12 @@ --- - hosts: vagrant vars: - yarn_clean_install: false - yarn_version: latest + docker_users: + - ziion become: true roles: - common - geerlingguy.docker - truffle - + - ganache + - remix diff --git a/ansible/roles/common/tasks/install-node.yml b/ansible/roles/common/tasks/install-node.yml index ee50de3..2477827 100644 --- a/ansible/roles/common/tasks/install-node.yml +++ b/ansible/roles/common/tasks/install-node.yml @@ -8,7 +8,7 @@ pkg: - curl -- name: Remove node +- name: Remove nodejs become_user: root become: true apt: @@ -18,12 +18,12 @@ pkg: - nodejs -- name: add node apt repository +- name: add nodejs apt repository become_user: root become: true ansible.builtin.shell: "curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - " -- name: Install node +- name: Install nodejs become_user: root become: true apt: @@ -32,3 +32,9 @@ cache_valid_time: 604800 pkg: - nodejs + +- name: + become_user: root + become: true + ansible.builtin.shell: "corepack enable" + diff --git a/ansible/roles/ganache/tasks/install-via-docker.yml b/ansible/roles/ganache/tasks/install-via-docker.yml new file mode 100644 index 0000000..b8cb44b --- /dev/null +++ b/ansible/roles/ganache/tasks/install-via-docker.yml @@ -0,0 +1,8 @@ +- name: Create ganache + community.docker.docker_container: + name: ganache + image: trufflesuite/ganache:v7.1.0 + state: started + restart: true + ports: + - "127.0.0.1:8545:8545" # discuss if this should be bind all gitlab.com/reel/ziion-tools/-/issues/4 diff --git a/ansible/roles/ganache/tasks/install-via-npm.yml b/ansible/roles/ganache/tasks/install-via-npm.yml new file mode 100644 index 0000000..2e96c71 --- /dev/null +++ b/ansible/roles/ganache/tasks/install-via-npm.yml @@ -0,0 +1,7 @@ +- name: Install ganache + community.general.npm: + name: ganache + version: '7.1.0' + path: /usr/local/ganache + global: true + state: present diff --git a/ansible/roles/ganache/tasks/main.yml b/ansible/roles/ganache/tasks/main.yml new file mode 100644 index 0000000..410e7dc --- /dev/null +++ b/ansible/roles/ganache/tasks/main.yml @@ -0,0 +1,7 @@ +--- + +#- import_tasks: install-via-npm.yml +# tags: install-via-npm + +- import_tasks: install-via-docker.yml + tags: install-via-docker diff --git a/ansible/roles/remix/tasks/main.yml b/ansible/roles/remix/tasks/main.yml new file mode 100644 index 0000000..62097ea --- /dev/null +++ b/ansible/roles/remix/tasks/main.yml @@ -0,0 +1,9 @@ +- name: Create remix-ide + community.docker.docker_container: + name: remix-ide + image: remixproject/remix-ide + state: started + restart: true + ports: + # Publish container port 80 as host port 8080 + - "127.0.0.1:8080:80" diff --git a/ansible/roles/requirements.yml b/ansible/roles/requirements.yml index 203e464..8be8557 100644 --- a/ansible/roles/requirements.yml +++ b/ansible/roles/requirements.yml @@ -1,9 +1,8 @@ --- # ansible-galaxy install -r roles/requirements.yml +collections: +- community.docker -- src: fubarhouse.yarn -# version: latest - name: fubarhouse.yarn - src: geerlingguy.docker name: geerlingguy.docker diff --git a/ansible/roles/truffle/tasks/main.yml b/ansible/roles/truffle/tasks/main.yml index e69de29..b1df5b3 100644 --- a/ansible/roles/truffle/tasks/main.yml +++ b/ansible/roles/truffle/tasks/main.yml @@ -0,0 +1,7 @@ +- name: Install truffle + community.general.npm: + name: truffle + version: '5.5.14' + path: /usr/local/truffle + global: true + state: present