Finished lb and db

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2024-09-19 23:10:00 +02:00
parent 50abbf933c
commit 51a49d003d
51 changed files with 384 additions and 367 deletions

View File

@@ -1,10 +1,9 @@
---
- name: Copy .bashrc
template:
src: templates/common/bash/bashrc.j2
src: files/bash/bashrc
dest: "/home/{{ user }}/.bashrc"
owner: "{{ user }}"
group: "{{ user }}"
mode: 0644
become: yes
register: sshd

View File

@@ -0,0 +1,14 @@
---
- name: Set a hostname
ansible.builtin.hostname:
name: "{{ host.hostname }}"
become: true
- name: Update /etc/hosts to reflect the new hostname
lineinfile:
path: /etc/hosts
regexp: '^127\.0\.1\.1'
line: "127.0.1.1 {{ host.hostname }}"
state: present
backup: yes
become: true

View File

@@ -1,5 +1,6 @@
---
- include_tasks: time.yml
- include_tasks: essential.yml
- include_tasks: hostname.yml
- include_tasks: packages.yml
- include_tasks: bash.yml
- include_tasks: sshd.yml

View File

@@ -1,5 +1,5 @@
---
- name: Update and upgrade packages
- name: Update and upgrade packages
apt:
update_cache: yes
upgrade: yes

View File

@@ -1,11 +1,12 @@
---
- name: Copy sshd_config
template:
src: templates/common/ssh/sshd_config
src: templates/ssh/sshd_config
dest: /etc/ssh/sshd_config
mode: 0644
notify:
- Restart sshd
become: yes
register: sshd
- name: Copy pubkey
copy:
@@ -14,10 +15,3 @@
owner: "{{ user }}"
group: "{{ user }}"
mode: "644"
- name: Restart sshd
service:
name: "sshd"
state: "restarted"
become: yes
when: sshd.changed