blob: a1f1b284604a89a5cc5b8dfe86d7f6ea78edc8ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
- hosts: localhost
gather_facts: no
connection: local
vars:
ansible_effect:
"on": true
"effect": "colorloop"
ansible_none:
"on": true
"effect": "none"
tasks:
- name: INCLUDE UNIQUE USERNAME FROM REGISTER.YML
include_vars:
file: username_info.yml
- name: GRAB HUE LIGHT INFORMATION
uri:
url: "http://{{ip_address}}/api/{{username}}"
method: GET
body: '{{body_info|to_json}}'
register: light_info
- name: TURN LIGHTS INTO COLORLOOP EFFECT
uri:
url: "http://{{ip_address}}/api/{{username}}/lights/{{item}}/state"
method: PUT
body: '{{ansible_effect|to_json}}'
loop: "{{ range(1, light_info.json.lights | length + 1)|list }}"
# Pause for 10 seconds
- pause:
seconds: 5
- name: TURN LIGHTS INTO COLORLOOP EFFECT
uri:
url: "http://{{ip_address}}/api/{{username}}/lights/{{item}}/state"
method: PUT
body: '{{ansible_none|to_json}}'
loop: "{{ range(1, light_info.json.lights | length + 1)|list }}"
|