Add README steps to create user dev
This commit is contained in:
parent
f40ca9ac83
commit
23bb995e8e
@ -45,3 +45,44 @@ To get started, follow the [installation](../README.md#installation) guide to se
|
|||||||
```bash
|
```bash
|
||||||
ansible-playbook setup-dns.yml
|
ansible-playbook setup-dns.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Setup User `dev`
|
||||||
|
|
||||||
|
- 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 -k
|
||||||
|
|
||||||
|
# Expected output:
|
||||||
|
|
||||||
|
# <host_name> | SUCCESS => {
|
||||||
|
# "ansible_facts": {
|
||||||
|
# "discovered_interpreter_python": "/usr/bin/python3.10"
|
||||||
|
# },
|
||||||
|
# "changed": false,
|
||||||
|
# "ping": "pong"
|
||||||
|
# }
|
||||||
|
```
|
||||||
|
|
||||||
|
- Execute the `setup-user.yml` Ansible playbook to create a user `dev` with sudo permissions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-playbook setup-user.yml -i hosts.ini --extra-vars='{ "target_host": "deployment_host" }'
|
||||||
|
```
|
||||||
|
@ -78,23 +78,23 @@
|
|||||||
- /var/lib/snapd
|
- /var/lib/snapd
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: Create a user named 'so'
|
- name: Create a user `dev`
|
||||||
user:
|
user:
|
||||||
name: so
|
name: dev
|
||||||
password: "{{ 'so-service-provider' | password_hash('sha512') }}"
|
password: "{{ 'so-service-provider' | password_hash('sha512') }}"
|
||||||
shell: /bin/zsh
|
shell: /bin/zsh
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add 'so' user to sudoers group
|
- name: Add dev' user to sudoers group
|
||||||
user:
|
user:
|
||||||
name: so
|
name: dev
|
||||||
groups: sudo
|
groups: sudo
|
||||||
append: yes
|
append: yes
|
||||||
|
|
||||||
- name: Ensure .ssh directory exists for 'so' user
|
- name: Ensure .ssh directory exists for 'dev' user
|
||||||
file:
|
file:
|
||||||
path: /home/so/.ssh
|
path: /home/dev/.ssh
|
||||||
state: directory
|
state: directory
|
||||||
owner: so
|
owner: dev
|
||||||
group: so
|
group: dev
|
||||||
mode: '0700'
|
mode: '0700'
|
||||||
|
Loading…
Reference in New Issue
Block a user