testnet-ops/l2-setup/run-optimism.yml

98 lines
3.5 KiB
YAML
Raw Normal View History

- name: Setup L2 on host
hosts: "{{ target_host }}"
vars_files:
- setup-vars.yml
- l2-vars.yml
environment:
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
tasks:
- name: Create directory for L2
file:
path: "{{ l2_directory }}"
state: directory
- name: Change owner of l2-directory
file:
path: "{{ l2_directory }}"
owner: "{{ansible_user}}"
group: "{{ansible_user}}"
state: directory
recurse: yes
- name: Clone fixturenet-optimism-stack
2024-09-17 12:38:59 +00:00
expect:
command: laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack --pull
responses:
"Are you sure you want to continue connecting \\(yes/no/\\[fingerprint\\]\\)\\?": "yes"
timeout: 300
ignore_errors: yes
- name: Clone required repositories for fixturenet-optimism
2024-09-17 12:38:59 +00:00
expect:
command: laconic-so --stack {{ ansible_env.HOME }}/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism setup-repositories --pull
responses:
"Are you sure you want to continue connecting \\(yes/no/\\[fingerprint\\]\\)\\?": "yes"
timeout: 300
ignore_errors: yes
- name: Build container images for L2
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism build-containers --force-rebuild
when: not skip_container_build
- name: Generate spec file for L2 deployment
template:
src: "./templates/specs/l2-spec.yml.j2"
dest: "{{ l2_directory }}/optimism-spec.yml"
- name: Check if the deployment directory exists for L2
stat:
path: "{{ l2_directory }}/optimism-deployment"
register: l2_deployment_dir
- name: Create a deployment from the spec file for L2
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy create --spec-file optimism-spec.yml --deployment-dir optimism-deployment
args:
chdir: "{{ l2_directory }}"
when: not l2_deployment_dir.stat.exists
- name: Generate config.env for L2 deployment
template:
src: "./templates/configs/l2-config.env.j2"
dest: "{{ l2_directory }}/optimism-deployment/config.env"
- name: Copy deployed contract addresses and configuration files
block:
- name: Copy l1 deployment file
copy:
src: "{{ artifact_path }}/l1_deployment/{{ l1_chain_id }}-deploy.json"
dest: "{{ l2_directory }}/optimism-deployment/data/l1_deployment"
remote_src: "{{ target_host != 'localhost' }}"
- name: Copy l2 configuration file
copy:
src: "{{ artifact_path }}/l2_config/{{ l1_chain_id }}.json"
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
remote_src: "{{ target_host != 'localhost' }}"
- name: Copy allocs-l2 file
copy:
src: "{{ artifact_path }}/l2_config/allocs-l2.json"
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
remote_src: "{{ target_host != 'localhost' }}"
- name: Copy l2 accounts file
copy:
src: "{{ artifact_path }}/l2_accounts/accounts.json"
dest: "{{ l2_directory }}/optimism-deployment/data/l2_accounts"
remote_src: "{{ target_host != 'localhost' }}"
when: existing_contracts_deployment
- name: Start L2-deployment
command: laconic-so deployment --dir optimism-deployment start
args:
chdir: "{{ l2_directory }}"