File tree Expand file tree Collapse file tree 9 files changed +86
-5
lines changed Expand file tree Collapse file tree 9 files changed +86
-5
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ The license indication in the project's sources is compliant with the [REUSE spe
4141[ codingteam.org.ru ] : https://codingteam.org.ru
4242[ devops ] : https://ru.wikipedia.org/wiki/DevOps
4343[ docs.license ] : LICENSES/MIT.txt
44- [ host.xmpp2 ] : xmpp2/HOST .md
44+ [ host.xmpp2 ] : xmpp2/README .md
4545[ hosts/cthulhu-3 ] : cthulhu-3/Host.md
4646[ hosts/ctor ] : ctor/Host.md
4747[ hosts/omnissiah ] : omnissiah/Host.md
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2025 Friedrich von Never <friedrich@fornever.me>
2+ #
3+ # SPDX-License-Identifier: MIT
4+
5+ hosts.ini
6+
7+ vars /vars.yml
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ <!--
2+ SPDX-FileCopyrightText: 2025 Friedrich von Never <friedrich@fornever.me>
3+
4+ SPDX-License-Identifier: MIT
5+ -->
6+
7+ xmpp2 host
8+ ==========
9+ - ** Provider:** Digital Ocean
10+ - ** OS** : Ubuntu 24.04
11+
12+ How to Deploy
13+ -------------
14+ 1 . Copy ` hosts.example.ini ` to ` hosts.ini ` , fix the host connection details if needed.
15+ 2 . Copy ` vars/vars.example.yml ` to ` vars/vars.yml ` and adjust it accordingly.
16+ 3 . To ** check the results** without applying, run ` ansible-playbook --check --diff default.yml ` .
17+
18+ To ** deploy** , run ` ansible-playbook default.yml ` .
19+
20+ If on Windows, feel free to use scripts ` ansible-playbook.ps1 ` as a substitute to use Ansible from WSL.
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2025 Friedrich von Never <friedrich@fornever.me>
2+ #
3+ # SPDX-License-Identifier: MIT
4+
5+ wsl -- distribution Ubuntu ansible- playbook -- inventory hosts.ini @args - e ' ansible_ssh_pipelining=True'
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2025 Friedrich von Never <friedrich@fornever.me>
2+ #
3+ # SPDX-License-Identifier: MIT
4+
5+ - import_playbook : users.yml
Original file line number Diff line number Diff line change 1+ ; SPDX-FileCopyrightText: 2025 Friedrich von Never <friedrich@fornever.me>
2+ ;
3+ ; SPDX-License-Identifier: MIT
4+
5+ [xmpp2]
6+ xmpp2 ansible_user =mario ansible_ssh_private_key_file =/home/mario/.ssh/xmpp2
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Set up user
3+ hosts : xmpp2
4+ become : true
5+
6+ vars_files :
7+ - vars.yml
8+
9+ handlers :
10+ - name : Reload sshd
11+ ansible.builtin.service :
12+ name : ssh
13+ state : reloaded
14+
15+ tasks :
16+ - name : Ensure a group exists for those who can connect with SSH
17+ ansible.builtin.group :
18+ name : sshuser
19+
20+ - name : Ensure a user exists and can SSH into the machine
21+ ansible.builtin.user :
22+ name : ' {{ user.name }}'
23+ shell : /bin/sh
24+ groups : [ 'sudo', 'sshuser' ]
25+ append : true
26+ home : ' /home/{{ user.name }}'
27+ password_lock : true
28+
29+ - name : Ensure the user can use SSH
30+ ansible.posix.authorized_key :
31+ user : ' {{ user.name }}'
32+ key : ' {{ user.ssh_key }}'
33+
34+ - name : Ensure only members of sshuser group can connect via SSH
35+ ansible.builtin.lineinfile :
36+ path : /etc/ssh/sshd_config
37+ line : ' AllowGroups sshuser'
38+ validate : ' sshd -f %s -t'
39+ notify : Reload sshd
Original file line number Diff line number Diff line change 1+ user :
2+ name : mario
3+ ssh_key : ' ssh-ed25519 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXX/XXX username1@hostname'
You can’t perform that action at this time.
0 commit comments