testnet-ops/service-provider-setup/setup-k8s.yml
2024-10-01 04:47:17 +00:00

59 lines
1.5 KiB
YAML

- name: Install Stack Orchestrator if it isn't present
import_playbook: ../stack-orchestrator-setup/setup-laconic-so.yml
- name: Setup k8s
hosts: "{{ target_host }}"
vars_files:
- k8s-vars.yml
tasks:
- name: Install Python and pip
apt:
name: "{{ item }}"
state: present
become: true
loop:
- python3
- python3-pip
- name: Install Ansible on remote host
pip:
name: ansible
extra_args: --user
when: target_host != "localhost"
- name: Ensure ~/.local/bin is in PATH in .bashrc
lineinfile:
path: ~/.bashrc
line: 'export PATH="$HOME/.local/bin:$PATH"'
state: present
create: yes
- name: Clone the service provider template repo
git:
repo: "https://git.vdb.to/cerc-io/service-provider-template.git"
dest: "{{ ansible_env.HOME }}/service-provider-template"
- name: Update .vault/vault-keys file
lineinfile:
path: "service-provider-template/.vault/vault-keys"
regexp: '^.*$'
line: "{{ gpg_key_id }}"
create: yes
- name: Start GPG agent
command: gpg-agent --daemon
ignore_errors: yes
- name: Set VAULT_KEY environment variable
shell: export VAULT_KEY='{{ vault_passphrase }}'
- name: Run vault-rekey.sh
expect:
command: bash .vault/vault-rekey.sh
responses:
"Enter passphrase:": "{{ vault_passphrase }}"
args:
chdir: "service-provider-template"