diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01924ba --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +ansible/roles/geerlingguy.docker/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4ae87b..168ffff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,4 +13,4 @@ crowdfunding page: *** ## 1st Round: Primary Sponsors (400,000 SATS or more): - Bryan Black (Website: https://bringyourwallet.com) + Bryan Black (Website: https://example.com) diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 0000000..3ae14af --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,12 @@ +[defaults] + +# some basic default values... + +interpreter_python = auto +inventory = ./inventory/ +roles_path = ./roles/ +stdout_callback = default + +#[ssh_connection] +#ssh_args=-o ControlMaster=auto -o ControlPersist=60s -o ControlPath=/tmp/ansible-ssh-%h-%p-%r -o ForwardAgent=yes + diff --git a/ansible/inventory/hosts b/ansible/inventory/hosts new file mode 100644 index 0000000..e6849b8 --- /dev/null +++ b/ansible/inventory/hosts @@ -0,0 +1,5 @@ +[localhost] +127.0.0.1 ansible_connection=local + +[vagrant] +10.0.0.159:3322 ansible_user=ziion diff --git a/ansible/plays/evm-tools.yml b/ansible/plays/evm-tools.yml new file mode 100644 index 0000000..9989d0a --- /dev/null +++ b/ansible/plays/evm-tools.yml @@ -0,0 +1,20 @@ +--- +- hosts: vagrant + vars: + ziionos_user: ziion + bash_line: "export PATH=$PATH:$HOME/.local/bin" # pipx support for user install + bash_line_state: present + docker_users: + - ziion + become: true + roles: + - common + - geerlingguy.docker + - truffle + - solc + - solc-select + - brownie + - manticore + - mythril + - ganache + - remix diff --git a/ansible/roles/brownie/tasks/install-python3venv.yml b/ansible/roles/brownie/tasks/install-python3venv.yml new file mode 100644 index 0000000..a700db1 --- /dev/null +++ b/ansible/roles/brownie/tasks/install-python3venv.yml @@ -0,0 +1,9 @@ +- name: Install python3-venv + become_user: root + become: true + apt: + state: present + update_cache: yes + cache_valid_time: 604800 + pkg: + - python3-venv diff --git a/ansible/roles/brownie/tasks/main.yml b/ansible/roles/brownie/tasks/main.yml new file mode 100644 index 0000000..3a3f4b2 --- /dev/null +++ b/ansible/roles/brownie/tasks/main.yml @@ -0,0 +1,16 @@ +- name: Install pipx package for brownie + become_user: "{{ ziionos_user }}" + ansible.builtin.pip: + name: pipx + extra_args: --user + +- import_tasks: install-python3venv.yml + tags: + - install-python3venv + +- name: pipx install eth-brownie + become_user: "{{ ziionos_user }}" + become: true + ansible.builtin.shell: "/home/{{ ziionos_user }}/.local/bin/pipx install eth-brownie==1.18.2" + args: + executable: /bin/bash diff --git a/ansible/roles/common/tasks/install-bashrc.yml b/ansible/roles/common/tasks/install-bashrc.yml new file mode 100644 index 0000000..0e1917c --- /dev/null +++ b/ansible/roles/common/tasks/install-bashrc.yml @@ -0,0 +1,6 @@ +- name: Configure bashrc lines + lineinfile: + path: "/home/{{ ziionos_user }}/.bashrc" + line: "{{ bash_line }}" + state: "{{ bash_line_state |default('present') }}" + backup: yes diff --git a/ansible/roles/common/tasks/install-node.yml b/ansible/roles/common/tasks/install-node.yml new file mode 100644 index 0000000..2477827 --- /dev/null +++ b/ansible/roles/common/tasks/install-node.yml @@ -0,0 +1,40 @@ +- name: Install curl + become_user: root + become: true + apt: + state: present + update_cache: yes + cache_valid_time: 604800 + pkg: + - curl + +- name: Remove nodejs + become_user: root + become: true + apt: + state: absent + update_cache: yes + cache_valid_time: 604800 + pkg: + - nodejs + +- 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 nodejs + become_user: root + become: true + apt: + state: present + update_cache: yes + cache_valid_time: 604800 + pkg: + - nodejs + +- name: + become_user: root + become: true + ansible.builtin.shell: "corepack enable" + diff --git a/ansible/roles/common/tasks/install-pip.yml b/ansible/roles/common/tasks/install-pip.yml new file mode 100644 index 0000000..ecf0186 --- /dev/null +++ b/ansible/roles/common/tasks/install-pip.yml @@ -0,0 +1,9 @@ +- name: Install pip3 + become_user: root + become: true + apt: + state: present + update_cache: yes + cache_valid_time: 604800 + pkg: + - python3-pip diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml new file mode 100644 index 0000000..e339554 --- /dev/null +++ b/ansible/roles/common/tasks/main.yml @@ -0,0 +1,12 @@ +--- +- import_tasks: install-node.yml + tags: + - install-node + +- import_tasks: install-pip.yml + tags: + - install-pip + +- import_tasks: install-bashrc.yml + tags: + - install-bashrc 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/manticore/tasks/install-via-docker.yml b/ansible/roles/manticore/tasks/install-via-docker.yml new file mode 100644 index 0000000..d6dac40 --- /dev/null +++ b/ansible/roles/manticore/tasks/install-via-docker.yml @@ -0,0 +1,6 @@ +- name: Create manticore + community.docker.docker_container: + name: manticore + image: trailofbits/manticore:0.3.7 + state: started + restart: true diff --git a/ansible/roles/manticore/tasks/install-via-pip.yml b/ansible/roles/manticore/tasks/install-via-pip.yml new file mode 100644 index 0000000..1769ca1 --- /dev/null +++ b/ansible/roles/manticore/tasks/install-via-pip.yml @@ -0,0 +1,4 @@ +- name: Install manticore python package + ansible.builtin.pip: + name: manticore==0.3.7 + state: present diff --git a/ansible/roles/manticore/tasks/main.yml b/ansible/roles/manticore/tasks/main.yml new file mode 100644 index 0000000..39e31f0 --- /dev/null +++ b/ansible/roles/manticore/tasks/main.yml @@ -0,0 +1,6 @@ +--- +#- import_tasks: install-via-pip.yml +# tags: install-via-pip + +- import_tasks: install-via-docker.yml + tags: install-via-docker diff --git a/ansible/roles/mythril/tasks/install-via-docker.yml b/ansible/roles/mythril/tasks/install-via-docker.yml new file mode 100644 index 0000000..07b3bd9 --- /dev/null +++ b/ansible/roles/mythril/tasks/install-via-docker.yml @@ -0,0 +1,6 @@ +- name: Create mythril + community.docker.docker_container: + name: manticore + image: mythril/myth:0.23.1 + state: started + restart: true diff --git a/ansible/roles/mythril/tasks/install-via-pip.yml b/ansible/roles/mythril/tasks/install-via-pip.yml new file mode 100644 index 0000000..e7acdba --- /dev/null +++ b/ansible/roles/mythril/tasks/install-via-pip.yml @@ -0,0 +1,4 @@ +- name: Install mythril python package + ansible.builtin.pip: + name: mythril==0.23.1 + state: present diff --git a/ansible/roles/mythril/tasks/main.yml b/ansible/roles/mythril/tasks/main.yml new file mode 100644 index 0000000..9bb5a57 --- /dev/null +++ b/ansible/roles/mythril/tasks/main.yml @@ -0,0 +1,9 @@ +--- +#- import_tasks: install-via-pip.yml +# tags: install-via-pip +# UNTESTED + + +- 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 new file mode 100644 index 0000000..8be8557 --- /dev/null +++ b/ansible/roles/requirements.yml @@ -0,0 +1,8 @@ +--- +# ansible-galaxy install -r roles/requirements.yml +collections: +- community.docker + + +- src: geerlingguy.docker + name: geerlingguy.docker diff --git a/ansible/roles/solc-select/tasks/main.yml b/ansible/roles/solc-select/tasks/main.yml new file mode 100644 index 0000000..2f63a52 --- /dev/null +++ b/ansible/roles/solc-select/tasks/main.yml @@ -0,0 +1,4 @@ +- name: Install solc-select python package + ansible.builtin.pip: + name: solc-select +# name: solc-select==1.0.1 diff --git a/ansible/roles/solc/tasks/main.yml b/ansible/roles/solc/tasks/main.yml new file mode 100644 index 0000000..8794bb2 --- /dev/null +++ b/ansible/roles/solc/tasks/main.yml @@ -0,0 +1,7 @@ +- name: Install solc-js + community.general.npm: + name: solc + version: '0.8.14-fixed' + path: /usr/local/solc + global: true + state: present diff --git a/ansible/roles/truffle/tasks/main.yml b/ansible/roles/truffle/tasks/main.yml new file mode 100644 index 0000000..b1df5b3 --- /dev/null +++ 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