Welcome to mirror list, hosted at ThFree Co, Russian Federation.

register.yml « phillips_hue - github.com/ansible/ansible-examples.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 38a7d6c60ddaaaf31d1af4fe5c6617f9142e0e38 (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
- hosts: localhost
  gather_facts: no
  connection: local

  tasks:

  - name: PROMPT USER TO PRESS PHYSICAL BUTTON HUE HUB
    pause:
      prompt: "Press the button on the hub now..."

  - name: INCLUDE IP ADDRESS FROM username_info.yml
    include_vars:
      file: username_info.yml

  - name: GRAB UNIQUE USERNAME
    uri:
      url: "http://{{ip_address}}/api"
      method: POST
      body: '{{body_info|to_json}}'
    register: username_info

  - name: PRINT DATA TO TERMINAL WINDOW
    debug:
      var: username_info.json
  - lineinfile:
      path: "./username_info.yml"
      regexp: '^username'
      insertafter: EOF
      line: 'username: {{username_info.json[0]["success"]["username"]}}'