upt playbook

This commit is contained in:
jaydee 2024-07-09 00:32:15 +02:00
parent 6a26651b96
commit 1c8f7e7431

View File

@ -14,7 +14,7 @@
ansible.builtin.copy: ansible.builtin.copy:
src: services/mqtt_srv.service src: services/mqtt_srv.service
dest: /etc/systemd/system/ dest: /etc/systemd/system/
when: inventory_hostname not in groups['nas'] when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router']
become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}"
@ -25,7 +25,7 @@
dest: /usr/bin/ dest: /usr/bin/
mode: '755' mode: '755'
owner: root owner: root
when: inventory_hostname not in groups['nas'] when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router']
become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}"
- name: Upload service script1 - name: Upload service script1
@ -44,7 +44,7 @@
dest: /jffs/scripts/mqtt_srv/ dest: /jffs/scripts/mqtt_srv/
mode: '755' mode: '755'
owner: root owner: root
when: inventory_hostname not in groups['router'] when: inventory_hostname in groups['router']
become: false become: false
- name: Upload service script1 - name: Upload service script1
@ -73,14 +73,14 @@
- ping3 - ping3
- psutil - psutil
- autorandr - autorandr
when: inventory_hostname not in groups['nas','router'] when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router']
become: "{{ 'no' if inventory_hostname in groups['nas','router'] else 'yes' }}" become: "{{ 'no' if inventory_hostname in groups['nas','router'] else 'yes' }}"
- name: Just force systemd to reread configs (2.4 and above) - name: Just force systemd to reread configs (2.4 and above)
ansible.builtin.systemd: ansible.builtin.systemd:
daemon_reload: true daemon_reload: true
when: inventory_hostname not in groups['nas'] when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router']
become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}"
@ -88,7 +88,7 @@
ansible.builtin.service: ansible.builtin.service:
name: mqtt_srv.service name: mqtt_srv.service
state: restarted state: restarted
when: inventory_hostname not in groups['nas'] when: inventory_hostname not in groups['nas'] and inventory_hostname not in groups['router']
become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}"
- name: Restart mqtt service - name: Restart mqtt service