diff --git a/playbooks/install_mqtt_srv.yml b/playbooks/install_mqtt_srv.yml index a51ec44..9e33fb9 100644 --- a/playbooks/install_mqtt_srv.yml +++ b/playbooks/install_mqtt_srv.yml @@ -18,6 +18,7 @@ become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + - name: Upload service script ansible.builtin.copy: src: scripts/mqtt_srv.py @@ -27,6 +28,25 @@ when: inventory_hostname not in groups['nas'] become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + - name: Upload service script1 + ansible.builtin.copy: + src: scripts/mqtt_srv.sh + dest: /jffs/scripts/mqtt_srv/ + mode: '755' + owner: root + when: inventory_hostname in groups['router'] + become: false + + + - name: Upload service script + ansible.builtin.copy: + src: scripts/mqtt_srv.py + dest: /jffs/scripts/mqtt_srv/ + mode: '755' + owner: root + when: inventory_hostname not in groups['router'] + become: false + - name: Upload service script1 ansible.builtin.copy: src: scripts/mqtt_srv.sh @@ -77,7 +97,13 @@ poll: 0 when: inventory_hostname in groups['nas'] become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" - + + - name: Restart mqtt service + ansible.builtin.shell: "(/jffs/scripts/mqtt_srv/mqtt_srv.sh restart >/dev/null 2>&1 &)" + async: 10 + poll: 0 + when: inventory_hostname in groups['router'] + become: false \ No newline at end of file