mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-07-01 15:38:33 +02:00
Compare commits
8 Commits
0c730c0b65
...
d4ee9dc3eb
Author | SHA1 | Date | |
---|---|---|---|
d4ee9dc3eb | |||
16414f9bc4 | |||
04eb197989 | |||
5957435c36 | |||
b3de421b3a | |||
977c9ca44e | |||
e15b4ec2a8 | |||
365a045d4d |
4
all.yml
4
all.yml
@ -3,6 +3,10 @@
|
|||||||
roles:
|
roles:
|
||||||
- name: common
|
- name: common
|
||||||
tags: common
|
tags: common
|
||||||
|
- name: hosts
|
||||||
|
tags: hosts
|
||||||
|
- name: ssh_config
|
||||||
|
tags: ssh_config
|
||||||
- name: wake_on_lan
|
- name: wake_on_lan
|
||||||
tags: wake_on_lan
|
tags: wake_on_lan
|
||||||
- name: matter-server
|
- name: matter-server
|
||||||
|
0
roles/hosts/files/hosts
Normal file
0
roles/hosts/files/hosts
Normal file
5
roles/hosts/handlers/main.yml
Executable file
5
roles/hosts/handlers/main.yml
Executable 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
28
roles/hosts/tasks/main.yml
Executable 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
24
roles/ssh_config/files/config
Executable 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
19
roles/ssh_config/tasks/main.yml
Executable 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
1
roles/ssh_config/vars/main.yml
Executable file
@ -0,0 +1 @@
|
|||||||
|
dest_folder: "/tmp/ans_repo"
|
Reference in New Issue
Block a user