mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-12-14 01:54:56 +01:00
build
This commit is contained in:
@@ -1,39 +1,46 @@
|
||||
- name: Install ethtool
|
||||
ansible.builtin.apt:
|
||||
name: ethtool
|
||||
state: present
|
||||
become: true
|
||||
- name: Display all interfaces name
|
||||
ansible.builtin.debug:
|
||||
var: ansible_facts.interfaces
|
||||
- name: Get wifi adapter
|
||||
ansible.builtin.set_fact:
|
||||
active_adapter: '{{ item }}'
|
||||
loop: '{{ ansible_facts.interfaces }}'
|
||||
when: '(item.startswith("eno") or item.startswith("enp")) and not item.endswith("avahi")'
|
||||
- name: Install zabbix agent
|
||||
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
|
||||
block:
|
||||
- name: Include facts
|
||||
ansible.builtin.include_role:
|
||||
name: "setup"
|
||||
when: ansible_facts.architecture is not defined
|
||||
- name: Install ethtool
|
||||
ansible.builtin.apt:
|
||||
name: ethtool
|
||||
state: present
|
||||
become: true
|
||||
- name: Display all interfaces name
|
||||
ansible.builtin.debug:
|
||||
var: ansible_facts.interfaces
|
||||
- name: Get wifi adapter
|
||||
ansible.builtin.set_fact:
|
||||
active_adapter: '{{ item }}'
|
||||
loop: '{{ ansible_facts.interfaces }}'
|
||||
when: '(item.startswith("eno") or item.startswith("enp") or item.startswith("nic")) and not item.endswith("avahi")'
|
||||
|
||||
|
||||
- name: Creating config
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
dest: "/etc/systemd/system/wol@.service"
|
||||
content: |
|
||||
[Unit]
|
||||
Description=Enable Wake On Lan
|
||||
- name: Creating config
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
dest: "/etc/systemd/system/wol@.service"
|
||||
content: |
|
||||
[Unit]
|
||||
Description=Enable Wake On Lan
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart = /usr/sbin/ethtool --change %i wol g
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart = /usr/sbin/ethtool --change %i wol g
|
||||
|
||||
[Install]
|
||||
WantedBy=basic.target
|
||||
owner: root
|
||||
mode: '0744'
|
||||
- name: Restart service wol, in all cases
|
||||
ansible.builtin.service:
|
||||
name: wol@{{ item }}
|
||||
state: restarted
|
||||
enabled: true
|
||||
become: true
|
||||
loop: '{{ ansible_facts.interfaces }}'
|
||||
when: '(item.startswith("eno") or item.startswith("enp")) and not item.endswith("avahi")'
|
||||
[Install]
|
||||
WantedBy=basic.target
|
||||
owner: root
|
||||
mode: '0744'
|
||||
- name: Restart service wol, in all cases
|
||||
ansible.builtin.service:
|
||||
name: wol@{{ item }}
|
||||
state: restarted
|
||||
enabled: 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