From 74ab04ebcde80b7ff1f61277b243c5c556f71316 Mon Sep 17 00:00:00 2001 From: Adw8 Date: Wed, 18 Sep 2024 17:40:57 +0530 Subject: [PATCH] Add tasks to install laconic-so, python, pip and ansible on remote host --- service-provider-setup/setup-k8s.yml | 31 +++++++++++++++++++++++++++ service-provider-setup/setup-user.yml | 4 ++-- stack-orchestrator-setup/README.md | 2 ++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 service-provider-setup/setup-k8s.yml diff --git a/service-provider-setup/setup-k8s.yml b/service-provider-setup/setup-k8s.yml new file mode 100644 index 0000000..6139b36 --- /dev/null +++ b/service-provider-setup/setup-k8s.yml @@ -0,0 +1,31 @@ +- 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: + target_host: "localhost" + + 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 diff --git a/service-provider-setup/setup-user.yml b/service-provider-setup/setup-user.yml index 415966e..f0f2e11 100644 --- a/service-provider-setup/setup-user.yml +++ b/service-provider-setup/setup-user.yml @@ -1,5 +1,5 @@ - name: Configure system - hosts: deployment_host + hosts: "{{ target_host }}" become: yes tasks: @@ -82,7 +82,7 @@ user: name: so password: "{{ 'so-service-provider' | password_hash('sha512') }}" - shell: /bin/bash + shell: /bin/zsh state: present - name: Add 'so' user to sudoers group diff --git a/stack-orchestrator-setup/README.md b/stack-orchestrator-setup/README.md index 7903e48..c101486 100644 --- a/stack-orchestrator-setup/README.md +++ b/stack-orchestrator-setup/README.md @@ -81,9 +81,11 @@ To run the playbook on a remote host: ```bash # For bash users echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc + source ~/.bashrc # For zsh users echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc + source ~/.zshrc ``` - Once the PATH is set, verify the installation by running the following commands: