mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-10-29 09:30:08 +01:00
lala
This commit is contained in:
@@ -163,3 +163,11 @@ datacenter:
|
|||||||
# ansible_user: admin
|
# ansible_user: admin
|
||||||
# ansible_pass: l4c1!j4yd33?Du5lo1
|
# ansible_pass: l4c1!j4yd33?Du5lo1
|
||||||
ansible_python_interpreter: /share/ZFS530_DATA/.qpkg/QPython312/bin/python3
|
ansible_python_interpreter: /share/ZFS530_DATA/.qpkg/QPython312/bin/python3
|
||||||
|
desktops:
|
||||||
|
hosts:
|
||||||
|
morefine.home.lan:
|
||||||
|
vars:
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
ansible_ssh_user: jd
|
||||||
|
ansible_become_password: q
|
||||||
|
ansible_ssh_private_key_file: ssh_key.pem
|
||||||
|
|||||||
@@ -29,44 +29,72 @@
|
|||||||
mode: '0600'
|
mode: '0600'
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
# - name: Creating a file with content
|
||||||
|
# ansible.builtin.copy:
|
||||||
|
# dest: "/etc/auto.nas-movies"
|
||||||
|
# content: |
|
||||||
|
# movies -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/movies
|
||||||
|
# mode: '0600'
|
||||||
|
# owner: root
|
||||||
|
# group: root
|
||||||
|
|
||||||
- name: Creating a file with content
|
- name: Creating a file with content
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "/etc/auto.nas-movies"
|
dest: "/etc/auto.nas-movies"
|
||||||
content: |
|
content: |
|
||||||
movies -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/movies
|
movies --fstype=nfs,rw nas.home.lan:/movies
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
|
||||||
- name: Creating a file with content
|
# - name: Creating a file with content
|
||||||
ansible.builtin.copy:
|
# ansible.builtin.copy:
|
||||||
dest: "/etc/auto.nas-music"
|
# dest: "/etc/auto.nas-music"
|
||||||
content: |
|
# content: |
|
||||||
music -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/music
|
# music -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/music
|
||||||
mode: '0600'
|
# mode: '0600'
|
||||||
owner: root
|
# owner: root
|
||||||
group: root
|
# group: root
|
||||||
|
|
||||||
- name: Creating a file with content
|
# - name: Creating a file with content
|
||||||
ansible.builtin.copy:
|
# ansible.builtin.copy:
|
||||||
dest: "/etc/auto.nas-shows"
|
# dest: "/etc/auto.nas-music"
|
||||||
content: |
|
# content: |
|
||||||
shows -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/shows
|
# music --fstype=nfs,rw ://nas.home.lan/music
|
||||||
mode: '0600'
|
# mode: '0600'
|
||||||
owner: root
|
# owner: root
|
||||||
group: root
|
# group: root
|
||||||
|
|
||||||
|
# - name: Creating a file with content
|
||||||
|
# ansible.builtin.copy:
|
||||||
|
# dest: "/etc/auto.nas-shows"
|
||||||
|
# content: |
|
||||||
|
# shows -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/shows
|
||||||
|
# mode: '0600'
|
||||||
|
# owner: root
|
||||||
|
# group: root
|
||||||
|
|
||||||
|
# - name: Creating a file with content
|
||||||
|
# ansible.builtin.copy:
|
||||||
|
# dest: "/etc/auto.nas"
|
||||||
|
# content: |
|
||||||
|
# nas-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Data
|
||||||
|
# nas-docker-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/docker_data
|
||||||
|
# nas-photo -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Photo
|
||||||
|
# nas-public -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Public
|
||||||
|
# nas-install -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/install
|
||||||
|
# nas-downloads -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/downloads
|
||||||
|
# nas-games -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/qda_2
|
||||||
|
# mode: '0600'
|
||||||
|
# owner: root
|
||||||
|
# group: root
|
||||||
|
|
||||||
- name: Creating a file with content
|
- name: Creating a file with content
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "/etc/auto.nas"
|
dest: "/etc/auto.nas"
|
||||||
content: |
|
content: |
|
||||||
nas-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Data
|
nas-data --fstype=nfs,rw nas.home.lan:/Data
|
||||||
nas-docker-data -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/docker_data
|
qda_1 --fstype=nfs,rw nas.home.lan:/qda_1
|
||||||
nas-photo -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Photo
|
|
||||||
nas-public -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/Public
|
|
||||||
nas-install -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/install
|
|
||||||
nas-downloads -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/downloads
|
|
||||||
nas-games -fstype=cifs,credentials=/etc/auto.auth,dir_mode=0755,file_mode=0755,uid=jd,rw ://nas.home.lan/qda_2
|
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
@@ -77,21 +105,21 @@
|
|||||||
# insertafter: '^/media/nas'
|
# insertafter: '^/media/nas'
|
||||||
# line: "/media/nas /etc/auto.nas --timeout 360 --ghost"
|
# line: "/media/nas /etc/auto.nas --timeout 360 --ghost"
|
||||||
|
|
||||||
- name: Reconfigure autofs Server
|
# - name: Reconfigure autofs Server
|
||||||
ansible.builtin.lineinfile:
|
# ansible.builtin.lineinfile:
|
||||||
path: /etc/auto.master
|
# path: /etc/auto.master
|
||||||
regexp: "^/media/data/music/nas.*"
|
# regexp: "^/media/data/music/nas.*"
|
||||||
line: /media/data/music/nas /etc/auto.nas-music --timeout 360 --ghost
|
# line: /media/data/music/nas /etc/auto.nas-music --timeout 360 --ghost
|
||||||
- name: Reconfigure autofs Server
|
- name: Reconfigure autofs Server
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/auto.master
|
path: /etc/auto.master
|
||||||
regexp: "^/media/data/movies/nas.*"
|
regexp: "^/media/data/movies/nas.*"
|
||||||
line: /media/data/movies/nas /etc/auto.nas-movies --timeout 360 --ghost
|
line: /media/data/movies/nas /etc/auto.nas-movies --timeout 360 --ghost
|
||||||
- name: Reconfigure autofs Server
|
# - name: Reconfigure autofs Server
|
||||||
ansible.builtin.lineinfile:
|
# ansible.builtin.lineinfile:
|
||||||
path: /etc/auto.master
|
# path: /etc/auto.master
|
||||||
regexp: "^/media/data/shows/nas.*"
|
# regexp: "^/media/data/shows/nas.*"
|
||||||
line: /media/data/shows/nas /etc/auto.nas-shows --timeout 360 --ghost
|
# line: /media/data/shows/nas /etc/auto.nas-shows --timeout 360 --ghost
|
||||||
|
|
||||||
|
|
||||||
- name: Reconfigure autofs Server
|
- name: Reconfigure autofs Server
|
||||||
|
|||||||
@@ -54,6 +54,14 @@
|
|||||||
group: root
|
group: root
|
||||||
remote_src: true
|
remote_src: true
|
||||||
when: inventory_hostname != 'nas.home.lan'
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
|
- name: Upload monitors script
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "get_monitors.sh"
|
||||||
|
dest: /myapps/mqtt_srv/get_monitors.sh
|
||||||
|
mode: '0755'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
when: inventory_hostname == 'morefine.home.lan'
|
||||||
- name: Upload service req
|
- name: Upload service req
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ dest_folder }}/requirements.txt"
|
src: "{{ dest_folder }}/requirements.txt"
|
||||||
|
|||||||
@@ -59,7 +59,15 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
when: inventory_hostname != 'nas.home.lan'
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
|
- name: Upload docker_backups.py
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ dest_folder }}/docker_backups.py"
|
||||||
|
dest: /myapps/docker_backups.py
|
||||||
|
remote_src: true
|
||||||
|
mode: '0755'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
when: inventory_hostname == 'm-server.home.lan'
|
||||||
- name: Install venv
|
- name: Install venv
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name:
|
name:
|
||||||
|
|||||||
@@ -10,23 +10,20 @@
|
|||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
active_adapter: '{{ item }}'
|
active_adapter: '{{ item }}'
|
||||||
loop: '{{ ansible_facts.interfaces }}'
|
loop: '{{ ansible_facts.interfaces }}'
|
||||||
when: 'item.startswith("eno")'
|
when: '(item.startswith("eno") or item.startswith("enp")) and not item.endswith("avahi")'
|
||||||
- name: Display all interfaces name
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "{{ ansible_default_ipv4.interface }}"
|
|
||||||
|
|
||||||
|
|
||||||
- name: Creating config
|
- name: Creating config
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "/etc/systemd/system/wol.service"
|
dest: "/etc/systemd/system/wol@.service"
|
||||||
content: |
|
content: |
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Enable Wake On Lan
|
Description=Enable Wake On Lan
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart = /usr/sbin/ethtool --change {{ ansible_default_ipv4.interface }} wol g
|
ExecStart = /usr/sbin/ethtool --change %i wol g
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=basic.target
|
WantedBy=basic.target
|
||||||
@@ -34,7 +31,9 @@
|
|||||||
mode: '0744'
|
mode: '0744'
|
||||||
- name: Restart service wol, in all cases
|
- name: Restart service wol, in all cases
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: wol
|
name: wol@{{ item }}
|
||||||
state: restarted
|
state: restarted
|
||||||
enabled: true
|
enabled: true
|
||||||
become: true
|
become: true
|
||||||
|
loop: '{{ ansible_facts.interfaces }}'
|
||||||
|
when: '(item.startswith("eno") or item.startswith("enp")) and not item.endswith("avahi")'
|
||||||
|
|||||||
Reference in New Issue
Block a user