Compare commits

...

8 Commits

7 changed files with 81 additions and 0 deletions

View File

@ -3,6 +3,10 @@
roles:
- name: common
tags: common
- name: hosts
tags: hosts
- name: ssh_config
tags: ssh_config
- name: wake_on_lan
tags: wake_on_lan
- name: matter-server

0
roles/hosts/files/hosts Normal file
View File

5
roles/hosts/handlers/main.yml Executable file
View File

@ -0,0 +1,5 @@
- name: restart_docker
ansible.builtin.service:
name: docker.service
state: restarted
become: true

28
roles/hosts/tasks/main.yml Executable file
View File

@ -0,0 +1,28 @@
- name: Hosts
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
block:
- name: Reconfigure hosts file
ansible.builtin.lineinfile:
path: "/etc/hosts"
regexp: "^192.168.77.101 .*"
line: "192.168.77.101 m-server m-server.home.lan"
- name: Reconfigure hosts file
ansible.builtin.lineinfile:
path: "/etc/hosts"
regexp: "^192.168.77.106 .*"
line: "192.168.77.106 nas nas.home.lan"
- name: Reconfigure hosts file
ansible.builtin.lineinfile:
path: "/etc/hosts"
regexp: "^192.168.77.238 .*"
line: "192.168.77.238 rpi5 rpi5.home.lan"
- name: Reconfigure hosts file
ansible.builtin.lineinfile:
path: "/etc/hosts"
regexp: "^192.168.77.4 .*"
line: "192.168.77.4 amd amd.home.lan"
- name: Reconfigure hosts file
ansible.builtin.lineinfile:
path: "/etc/hosts"
regexp: "^192.168.77.55 .*"
line: "192.168.77.55 rack rack.home.lan"

24
roles/ssh_config/files/config Executable file
View File

@ -0,0 +1,24 @@
Host m-server
HostName m-server.home.lan
Host rpi5
HostName rpi5.home.lan
Host rack
HostName rack.home.lan
Host amd
HostName amd.home.lan
Host nas
HostName nas.home.lan
User admin
Host router
HostName router.home.lan
User root
Host *
User jd
IdentityFile ~/.ssh/id_rsa
StrictHostKeyChecking no

19
roles/ssh_config/tasks/main.yml Executable file
View File

@ -0,0 +1,19 @@
- name: SSH config Setup
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
block:
- name: Upload config
ansible.builtin.copy:
src: config
dest: /home/jd/.ssh/config
mode: '0600'
owner: jd
group: jd
when: inventory_hostname != 'nas.home.lan'
- name: Upload config
ansible.builtin.copy:
src: config
dest: /root/.ssh/config
mode: '0600'
owner: root
group: root
when: inventory_hostname != 'nas.home.lan'

1
roles/ssh_config/vars/main.yml Executable file
View File

@ -0,0 +1 @@
dest_folder: "/tmp/ans_repo"