Add separate entry in hosts file for setting up user
This commit is contained in:
parent
3c22e3e569
commit
145dbae579
@ -4,68 +4,6 @@
|
||||
|
||||
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
|
||||
|
||||
## Setup a new User
|
||||
|
||||
- Create a new `hosts.ini` file:
|
||||
|
||||
```bash
|
||||
cp ../hosts.example.ini hosts.ini
|
||||
```
|
||||
|
||||
- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine:
|
||||
|
||||
```ini
|
||||
[deployment_host]
|
||||
<host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'
|
||||
```
|
||||
|
||||
- Replace `<host_name>` with the desired `hostname` of the remote machine
|
||||
- Replace `<target_ip>` with the IP address or hostname of the target machine
|
||||
- Replace `<ssh_user>` with `root`
|
||||
|
||||
- Verify that you are able to connect to the host using the following command:
|
||||
|
||||
```bash
|
||||
ansible all -m ping -i hosts.ini
|
||||
|
||||
# Expected output:
|
||||
|
||||
# <host_name> | SUCCESS => {
|
||||
# "ansible_facts": {
|
||||
# "discovered_interpreter_python": "/usr/bin/python3.10"
|
||||
# },
|
||||
# "changed": false,
|
||||
# "ping": "pong"
|
||||
# }
|
||||
```
|
||||
|
||||
- Setup `user-vars.yml` using the example file
|
||||
|
||||
```bash
|
||||
cd vars
|
||||
cp user-vars.example.yml user-vars.yml
|
||||
```
|
||||
|
||||
- Edit the following vars:
|
||||
|
||||
```bash
|
||||
# name of the user you want to setup on the target host
|
||||
username: ""
|
||||
|
||||
# password of the user you want to setup on the target host
|
||||
password: ""
|
||||
|
||||
# path to the ssh key on your machine
|
||||
path_to_ssh_key: "
|
||||
```
|
||||
|
||||
- Execute the `setup-user.yml` Ansible playbook to create a user with passwordless sudo permissions:
|
||||
|
||||
```bash
|
||||
cd ../
|
||||
ansible-playbook setup-user.yml -i hosts.ini --extra-vars='{ "target_host": "deployment_host" }'
|
||||
```
|
||||
|
||||
## Become a Service Provider
|
||||
|
||||
### Prerequisites
|
||||
@ -74,34 +12,11 @@ To get started, follow the [installation](../README.md#installation) guide to se
|
||||
|
||||
- Generate a DigitalOcean access token
|
||||
|
||||
- Create a PGP key on your target host
|
||||
|
||||
```
|
||||
gpg --full-generate-key
|
||||
```
|
||||
|
||||
- List the secret keys
|
||||
|
||||
```
|
||||
gpg --list-secret-keys --keyid-format=long
|
||||
```
|
||||
|
||||
- This will output something like this
|
||||
|
||||
```
|
||||
[keyboxd]
|
||||
---------
|
||||
sec rsa4096/0AFB10B643944C22 2024-05-03 [SC] [expires: 2025-05-03]
|
||||
17B3248D6784EC6CB43365A60AFB10B643944C22
|
||||
uid [ultimate] user <hello@laconic.com>
|
||||
```
|
||||
|
||||
Note the `0AFB10B643944C22` sequence of characters after `sec`. This will be required later.
|
||||
|
||||
- Copy the vars files:
|
||||
|
||||
```bash
|
||||
cd vars
|
||||
cp user-vars.example.yml user-vars.yml
|
||||
cp dns-vars.example.yml dns-vars.yml
|
||||
cp gpg-vars.example.yml gpg-vars.yml
|
||||
cp k8s-vars.example.yml k8s-vars.yml
|
||||
@ -112,6 +27,11 @@ To get started, follow the [installation](../README.md#installation) guide to se
|
||||
- Update the following values in the respective variable files:
|
||||
|
||||
```bash
|
||||
# vars/user-vars.yml
|
||||
username: "" # name of the user you want to setup on the target host
|
||||
password: "" # password of the user you want to setup on the target host
|
||||
path_to_ssh_key: "" # path to the ssh key on your machine
|
||||
|
||||
# vars/dns-vars.yml
|
||||
full_domain: "" # eg: laconic.com
|
||||
subdomain_prefix: "" # eg: lcn-cad
|
||||
@ -140,7 +60,41 @@ To get started, follow the [installation](../README.md#installation) guide to se
|
||||
memory_reservation: "" # Minimum amount of memory in GB to be used, eg: 4G
|
||||
```
|
||||
|
||||
- Update `ansible_user` in the [`hosts.ini`](./hosts.ini) file to the user on target host
|
||||
- Create a new `hosts.ini` file:
|
||||
|
||||
```bash
|
||||
cp ../hosts.example.ini hosts.ini
|
||||
```
|
||||
|
||||
- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine:
|
||||
|
||||
```ini
|
||||
[root_host]
|
||||
<host_name> ansible_host=<target_ip> ansible_user=root ansible_ssh_common_args='-o ForwardAgent=yes'
|
||||
|
||||
[deployment_host]
|
||||
<host_name> ansible_host=<target_ip> ansible_user=<new_username> ansible_ssh_common_args='-o ForwardAgent=yes'
|
||||
```
|
||||
|
||||
- Replace `<host_name>` with the desired `hostname` of the remote machine
|
||||
- Replace `<target_ip>` with the IP address or hostname of the target machine
|
||||
- Under `deployment_host`, Replace `<ansible_user>` with the name of the user you want to create
|
||||
|
||||
- Verify that you are able to connect to the host using the following command:
|
||||
|
||||
```bash
|
||||
ansible all -m ping -i hosts.ini
|
||||
|
||||
# Expected output:
|
||||
|
||||
# <host_name> | SUCCESS => {
|
||||
# "ansible_facts": {
|
||||
# "discovered_interpreter_python": "/usr/bin/python3.10"
|
||||
# },
|
||||
# "changed": false,
|
||||
# "ping": "pong"
|
||||
# }
|
||||
```
|
||||
|
||||
- Run the `service-provider-setup.yml` ansible-playbook to DNS records, deploy k8s, setup container registry, deploy the webapp-deployer API and webapp-deployer UI
|
||||
|
||||
|
@ -10,10 +10,6 @@
|
||||
- vars/container-vars.yml
|
||||
- vars/k8s-vars.yml
|
||||
- vars/dns-vars.yml
|
||||
- vars/user-vars.yml
|
||||
|
||||
become: yes
|
||||
become_user: "{{username}}"
|
||||
|
||||
tasks:
|
||||
- name: Ensure gpg-keys directory exists
|
||||
|
@ -8,10 +8,6 @@
|
||||
- vars/webapp-vars.yml
|
||||
- vars/dns-vars.yml
|
||||
- vars/k8s-vars.yml
|
||||
- vars/user-vars.yml
|
||||
|
||||
become: yes
|
||||
become_user: "{{username}}"
|
||||
|
||||
tasks:
|
||||
- name: Clone webapp-deployment-status-ui repository
|
||||
|
@ -8,10 +8,6 @@
|
||||
- vars/webapp-vars.yml
|
||||
- vars/dns-vars.yml
|
||||
- vars/k8s-vars.yml
|
||||
- vars/user-vars.yml
|
||||
|
||||
become: yes
|
||||
become_user: "{{username}}"
|
||||
|
||||
tasks:
|
||||
- name: Clone the stack repo
|
||||
|
@ -4,12 +4,6 @@
|
||||
environment:
|
||||
PATH: "{{ ansible_env.PATH }}:/home/{{ansible_user}}/bin"
|
||||
|
||||
vars_files:
|
||||
- vars/user-vars.yml
|
||||
|
||||
become: yes
|
||||
become_user: "{{username}}"
|
||||
|
||||
tasks:
|
||||
- name: Clone the fixturenet-laconicd-stack repo
|
||||
command: laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-laconicd-stack --pull
|
||||
|
@ -8,10 +8,6 @@
|
||||
- vars/k8s-vars.yml
|
||||
- vars/container-vars.yml
|
||||
- vars/dns-vars.yml
|
||||
- vars/user-vars.yml
|
||||
|
||||
become: yes
|
||||
become_user: "{{username}}"
|
||||
|
||||
tasks:
|
||||
- name: Generate spec file for the container-registry stack
|
||||
|
@ -12,10 +12,6 @@
|
||||
- vars/dns-vars.yml
|
||||
- vars/gpg-vars.yml
|
||||
- vars/k8s-vars.yml
|
||||
- vars/user-vars.yml
|
||||
|
||||
become: yes
|
||||
become_user: "{{username}}"
|
||||
|
||||
tasks:
|
||||
- name: Install Python and pip
|
||||
|
@ -8,10 +8,6 @@
|
||||
- vars/k8s-vars.yml
|
||||
- vars/dns-vars.yml
|
||||
- vars/gpg-vars.yml
|
||||
- vars/user-vars.yml
|
||||
|
||||
become: yes
|
||||
become_user: "{{username}}"
|
||||
|
||||
tasks:
|
||||
- name: Install required packages
|
||||
|
@ -1,5 +1,5 @@
|
||||
- name: Configure system
|
||||
hosts: "{{ target_host }}"
|
||||
hosts: root_host
|
||||
become: yes
|
||||
|
||||
vars_files:
|
||||
|
Loading…
Reference in New Issue
Block a user