📖 DOC:
This commit is contained in:
32
ansible.md
32
ansible.md
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
# Server SetUp for Ansible
|
# Server SetUp for Ansible
|
||||||
|
|
||||||
## Create ssh key ed25519
|
## Create ssh key ed25519
|
||||||
```bash
|
```bash
|
||||||
ssh-keygen -t ed25519 -C "any-name"
|
ssh-keygen -t ed25519 -C "any-name"
|
||||||
@@ -44,9 +43,40 @@ chmod 700 ~/.ssh/[KEY_NAME]
|
|||||||
ssh -i ~/.ssh/[KEY_NAME] [USER]@[HOST]
|
ssh -i ~/.ssh/[KEY_NAME] [USER]@[HOST]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Check logs in the Server
|
||||||
|
- For ssh logs
|
||||||
|
```bash
|
||||||
|
sudo journalctl -u ssh
|
||||||
|
```
|
||||||
|
- For general logs
|
||||||
|
```bash
|
||||||
|
sudo journalctl
|
||||||
|
```
|
||||||
|
- For since until logs
|
||||||
|
```bash
|
||||||
|
sudo journalctl --since "2021-09-01 00:00:00" --until "2021-09-01 23:59:59"
|
||||||
|
journalctl --since "2015-01-10" --until "2015-01-11 03:00"
|
||||||
|
journalctl --since "2015-01-10 17:15:00"
|
||||||
|
journalctl --since 09:00 --until "1 hour ago"
|
||||||
|
journalctl --since yesterday
|
||||||
|
```
|
||||||
|
- For TimeZone logs
|
||||||
|
```bash
|
||||||
|
timedatectl list-timezones
|
||||||
|
```
|
||||||
|
-For Set TimeZone
|
||||||
|
```bash
|
||||||
|
sudo timedatectl set-timezone America/Los_Angeles
|
||||||
|
```
|
||||||
|
- For Status TimeZone
|
||||||
|
```bash
|
||||||
|
timedatectl status
|
||||||
|
```
|
||||||
|
|
||||||
## Helpfull Links
|
## Helpfull Links
|
||||||
- [How to Create SSH Keys with Ed25519](https://phoenixnap.com/kb/ssh-with-key)
|
- [How to Create SSH Keys with Ed25519](https://phoenixnap.com/kb/ssh-with-key)
|
||||||
- [How To Configure SSH Key-Based Authentication on a Linux Server](https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server)
|
- [How To Configure SSH Key-Based Authentication on a Linux Server](https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server)
|
||||||
|
- [How To Use Journalctl to View and Manipulate Systemd Logs](https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs)
|
||||||
|
|
||||||
# Ansible
|
# Ansible
|
||||||
|
|
||||||
|
|||||||
12
install-docker.pb.yml
Normal file
12
install-docker.pb.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Path: main/install-docker.pb.yml
|
||||||
|
---
|
||||||
|
|
||||||
|
- hosts: ["devGroup"]
|
||||||
|
become: yes # Run tasks as root like sudo
|
||||||
|
tasks:
|
||||||
|
- name: Install Docker
|
||||||
|
tags: ["install-docker"]
|
||||||
|
apt:
|
||||||
|
name: docker.io
|
||||||
|
state: present
|
||||||
|
when: ansible_distribution in ["Ubuntu", "Debian"] and ansible_distribution_version in ["20.04", "22.04"]
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# Path: main/uatiz-required-packages.pb.yml
|
||||||
---
|
---
|
||||||
|
|
||||||
- hosts: ["main_server"]
|
- hosts: ["main_server"]
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
|
# Path: main/update-apt-packages.pb.yml
|
||||||
---
|
---
|
||||||
|
|
||||||
- hosts: ["main_server"]
|
- hosts: ["devGroup"]
|
||||||
become: yes
|
become: yes # Run tasks as root like sudo
|
||||||
tasks:
|
tasks:
|
||||||
- name: Update Repository Index [apt update]
|
- name: Update Repository Index [apt update]
|
||||||
tags: ["update-apt-packages"]
|
tags: ["update-apt-packages"]
|
||||||
package:
|
package:
|
||||||
update_cache: yes
|
update_cache: yes # Same as apt-get update
|
||||||
cache_valid_time: 3600
|
cache_valid_time: 3600 # Cache is valid for 1 hour
|
||||||
register: apt_update
|
register: apt_update # Register the output of the task
|
||||||
when: ansible_distribution in ["Ubuntu", "Debian"] and ansible_distribution_version in ["20.04", "22.04"]
|
when: ansible_distribution in ["Ubuntu", "Debian"] and ansible_distribution_version in ["20.04", "22.04"]
|
||||||
|
|
||||||
- name: Upgrade Dist[apt upgrade]
|
- name: Upgrade Dist[apt upgrade]
|
||||||
tags: ["upgrade-apt-packages"]
|
tags: ["upgrade-apt-packages"]
|
||||||
package:
|
package:
|
||||||
upgrade: dist
|
upgrade: dist # Same as apt-get dist-upgrade
|
||||||
force_apt_get: yes
|
force_apt_get: yes # Force apt-get instead of apt
|
||||||
autoremove: yes
|
autoremove: yes # Same as apt-get autoremove, remove unused dependency packages for all module states except build-dep
|
||||||
autoclean: yes
|
autoclean: yes # Same as apt-get autoclean, cleans the local repository of retrieved package files that can no longer be downloaded
|
||||||
when: ansible_distribution in ["Ubuntu", "Debian"] and ansible_distribution_version in ["20.04", "22.04"]
|
when: ansible_distribution in ["Ubuntu", "Debian"] and ansible_distribution_version in ["20.04", "22.04"]
|
||||||
Reference in New Issue
Block a user