Add ansible playbook to automate service provider setup #10
31
service-provider-setup/setup-k8s.yml
Normal file
31
service-provider-setup/setup-k8s.yml
Normal file
@ -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
|
@ -1,5 +1,5 @@
|
|||||||
- name: Configure system
|
- name: Configure system
|
||||||
hosts: deployment_host
|
hosts: "{{ target_host }}"
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
@ -82,7 +82,7 @@
|
|||||||
user:
|
user:
|
||||||
name: so
|
name: so
|
||||||
password: "{{ 'so-service-provider' | password_hash('sha512') }}"
|
password: "{{ 'so-service-provider' | password_hash('sha512') }}"
|
||||||
shell: /bin/bash
|
shell: /bin/zsh
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add 'so' user to sudoers group
|
- name: Add 'so' user to sudoers group
|
||||||
|
@ -81,9 +81,11 @@ To run the playbook on a remote host:
|
|||||||
```bash
|
```bash
|
||||||
# For bash users
|
# For bash users
|
||||||
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
|
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
|
||||||
|
source ~/.bashrc
|
||||||
|
|
||||||
# For zsh users
|
# For zsh users
|
||||||
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
|
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
|
||||||
|
source ~/.zshrc
|
||||||
```
|
```
|
||||||
|
|
||||||
- Once the PATH is set, verify the installation by running the following commands:
|
- Once the PATH is set, verify the installation by running the following commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user