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

63 lines
2.1 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
- 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 }}/fixturenet-optimism-spec.yml"
- name: Check if the deployment directory exists for L2
stat:
path: "{{ l2_directory }}/fixturenet-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 fixturenet-optimism-spec.yml --deployment-dir fixturenet-optimism-deployment
args:
chdir: "{{ l2_directory }}"
when: not l2_deployment_dir.stat.exists
- name: Copy config.env for L2 deployment
template:
src: "./templates/configs/l2-config.env"
dest: "{{ l2_directory }}/fixturenet-optimism-deployment/config.env"
- name: Start L2-deployment
command: laconic-so deployment --dir fixturenet-optimism-deployment start
args:
chdir: "{{ l2_directory }}"