87 lines
2.9 KiB
YAML
87 lines
2.9 KiB
YAML
- name: Setup L2 on host
|
|
hosts: "{{ target_host }}"
|
|
|
|
vars_files:
|
|
- 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
|
|
become: yes
|
|
|
|
- name: Clone fixturenet-optimism-stack
|
|
command: laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack --pull
|
|
ignore_errors: yes
|
|
|
|
- name: Clone required repositories for fixturenet-optimism
|
|
command: laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism setup-repositories --pull
|
|
|
|
- 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: Remove any dangling docker images
|
|
command: docker image prune -f
|
|
|
|
- name: Copy over 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"
|
|
dest: "{{ l2_directory }}/optimism-deployment/config.env"
|
|
|
|
- name: Copy deployed contract addresses and configuration files
|
|
block:
|
|
- name: Copy l1 deployment file
|
|
copy:
|
|
src: "{{ contract_addresses }}"
|
|
dest: "{{ l2_directory }}/optimism-deployment/data/l1_deployment"
|
|
|
|
- name: Copy l2 configuration file
|
|
copy:
|
|
src: "{{ l2_config_file }}"
|
|
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
|
|
|
|
- name: Copy allocs-l2 file
|
|
copy:
|
|
src: "{{ allocs_l2_file }}"
|
|
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
|
|
|
|
- name: Copy l2 jwt file
|
|
copy:
|
|
src: "{{ l2_jwt_file }}"
|
|
dest: "{{ l2_directory }}/optimism-deployment/data/l2_config"
|
|
when: existing_l1_deployment
|
|
|
|
- name: Start L2-deployment
|
|
command: laconic-so deployment --dir optimism-deployment start
|
|
args:
|
|
chdir: "{{ l2_directory }}"
|