Add playbooks for setting up docker and stack orchestrator
This commit is contained in:
parent
23f3a4c8ed
commit
85ba47f19d
@ -8,10 +8,10 @@ To get started, follow the [installation](../README.md#installation) guide to se
|
|||||||
|
|
||||||
The following commands have to be executed in the [`nitro-contracts-setup`](./) directory:
|
The following commands have to be executed in the [`nitro-contracts-setup`](./) directory:
|
||||||
|
|
||||||
- Copy the `contract-vars-example.yml` vars file
|
- Copy the `contract-vars.example.yml` vars file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp contract-vars-example.yml contract-vars.yml
|
cp contract-vars.example.yml contract-vars.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
- Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values
|
- Edit [`contract-vars.yml`](./contract-vars.yml) and fill in the following values
|
||||||
|
@ -16,7 +16,7 @@ To run the playbook on a remote host:
|
|||||||
|
|
||||||
The following commands have to be executed in [`nitro-nodes-setup`](./) directory
|
The following commands have to be executed in [`nitro-nodes-setup`](./) directory
|
||||||
|
|
||||||
- Copy the `nitro-vars-example.yml` vars file
|
- Copy the `nitro-vars.example.yml` vars file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp nitro-vars.example.yml nitro-vars.yml
|
cp nitro-vars.example.yml nitro-vars.yml
|
||||||
|
1
stack-orchestrator-setup/.gitignore
vendored
Normal file
1
stack-orchestrator-setup/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
hosts.ini
|
1
stack-orchestrator-setup/README.md
Normal file
1
stack-orchestrator-setup/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# stack-orchestrator-setup
|
92
stack-orchestrator-setup/setup-docker.yml
Normal file
92
stack-orchestrator-setup/setup-docker.yml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
- name: Set up Docker
|
||||||
|
hosts: remote_host
|
||||||
|
become: yes
|
||||||
|
vars:
|
||||||
|
docker_gpg_key_url: "https://download.docker.com/linux/ubuntu/gpg"
|
||||||
|
docker_gpg_key_path: "/etc/apt/keyrings/docker.asc"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Check if Docker is installed
|
||||||
|
command: which docker
|
||||||
|
register: is_docker_present
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Check if docker is present
|
||||||
|
debug:
|
||||||
|
var: "Output of `which docker` is {{ is_docker_present }}"
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Exit if docker is present
|
||||||
|
debug:
|
||||||
|
msg: "Docker already on host, ending play"
|
||||||
|
- meta: end_play
|
||||||
|
when: is_docker_present.rc == 0
|
||||||
|
|
||||||
|
- name: Update apt cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: Install prerequisites
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- ca-certificates
|
||||||
|
- curl
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Ensure keyrings directory exists
|
||||||
|
file:
|
||||||
|
path: "/etc/apt/keyrings"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Download Docker GPG key
|
||||||
|
get_url:
|
||||||
|
url: "{{ docker_gpg_key_url }}"
|
||||||
|
dest: "{{ docker_gpg_key_path }}"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Get system architecture
|
||||||
|
shell: dpkg --print-architecture
|
||||||
|
register: system_arch
|
||||||
|
|
||||||
|
- name: Add Docker repository
|
||||||
|
apt_repository:
|
||||||
|
repo: "deb [arch={{ system_arch.stdout }} signed-by={{ docker_gpg_key_path }}] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable"
|
||||||
|
state: present
|
||||||
|
filename: docker
|
||||||
|
|
||||||
|
- name: Update apt cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: Install Docker packages
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- docker-ce
|
||||||
|
- docker-ce-cli
|
||||||
|
- containerd.io
|
||||||
|
- docker-buildx-plugin
|
||||||
|
- docker-compose-plugin
|
||||||
|
state: latest
|
||||||
|
notify: Restart Docker
|
||||||
|
|
||||||
|
- name: Verify Docker installation by running the hello world image
|
||||||
|
command: docker run hello-world
|
||||||
|
register: hello_world_output
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Display hello-world output
|
||||||
|
debug:
|
||||||
|
var: hello_world_output.stdout_lines
|
||||||
|
|
||||||
|
- name: Add user to docker group
|
||||||
|
user:
|
||||||
|
name: "{{ ansible_user }}"
|
||||||
|
groups: docker
|
||||||
|
append: true
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: Restart Docker
|
||||||
|
service:
|
||||||
|
name: docker
|
||||||
|
state: restarted
|
47
stack-orchestrator-setup/setup-laconic-so.yml
Normal file
47
stack-orchestrator-setup/setup-laconic-so.yml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
- name: Install Docker if it isn't present
|
||||||
|
import_playbook: setup-docker.yml
|
||||||
|
|
||||||
|
- name: Set up Stack Orchestrator
|
||||||
|
hosts: remote_host
|
||||||
|
vars:
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Install jq
|
||||||
|
apt:
|
||||||
|
name: jq
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
- name: Ensure that directory ~/bin exists and is writable
|
||||||
|
file:
|
||||||
|
path: "{{ ansible_env.HOME }}/bin"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Download the laconic-so binary
|
||||||
|
get_url:
|
||||||
|
url: https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so
|
||||||
|
dest: "{{ ansible_env.HOME }}/bin/laconic-so"
|
||||||
|
mode: '0755'
|
||||||
|
force: yes
|
||||||
|
|
||||||
|
- name: Ensure ~/bin is on the PATH in .zshrc
|
||||||
|
lineinfile:
|
||||||
|
path: "{{ ansible_env.HOME }}/.zshrc"
|
||||||
|
regexp: '^export PATH=.*{{ ansible_env.HOME }}/bin'
|
||||||
|
line: 'export PATH="{{ ansible_env.HOME }}/bin:$PATH"'
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Ensure ~/.laconic-so directory exists
|
||||||
|
file:
|
||||||
|
path: "{{ ansible_env.HOME }}/.laconic-so"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Save the distribution url to ~/.laconic-so directory
|
||||||
|
copy:
|
||||||
|
dest: "{{ ansible_env.HOME }}/.laconic-so/config.yml"
|
||||||
|
content: |
|
||||||
|
distribution-url: https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so
|
||||||
|
mode: '0644'
|
Loading…
Reference in New Issue
Block a user