File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -19,24 +19,27 @@ influxdb_bucket_{{ config['name'] }}:
1919 - pkg: jq
2020{%- set bucket = salt[' cmd.shell' ](" influx bucket list --json | jq -r '.[] | select(.name == \" " + config[' name' ] + " \" ).id'" ) % }
2121{% else % }
22+ {%- set orgID = salt[' cmd.shell' ](" curl -s -f -H'Authorization: Token {{ influxdb['user']['admin']['token'] }} ' https://{{ influxdb['remote']['host'] }} /api/v2/orgs | jq -r '.[0].id'" ) % }
23+
2224get_bucket_{{ config[' name' ] }}:
2325 http.query:
2426 - name: ' https://{{ influxdb[' remote' ][' host' ] }} /api/v2/buckets/{{ config[' name' ] }} '
27+ - port: 8086
2528 - status: 200
2629 - method: GET
2730 - header_dict:
2831 Authorization: Token {{ influxdb[' user' ][' admin' ][' token' ] }}
2932
3033{%- set bucket_data = {
31- name: config[' name' ],
32- description: config[' description' ] | default(' A bucket for ' + config[' name' ]),
33- orgID: config[' orgID' ],
34- retentionRules: [],
35- rp: config[' retention_policy' ]
34+ ' name' : config[' name' ],
35+ ' description' : config[' description' ] | default(' A bucket for ' + config[' name' ]),
36+ ' orgID' : orgID,
37+ ' rp' : config[' retention_policy' ] | default(' 0' ),
3638} % }
3739create_bucket_{{ config[' name' ] }}:
3840 http.query:
3941 - name: ' https://{{ influxdb[' remote' ][' host' ] }} /api/v2/buckets'
42+ - port: 8086
4043 - status: 200
4144 - method: POST
4245 - data: ' {{ bucket_data | tojson }} '
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ influxdb_user_{{ loop.index0 }}:
2121get_user_{{ loop.index0 }}:
2222 http.query:
2323 - name: ' https://{{ influxdb[' remote' ][' host' ] }} /api/v2/users/{{ name }} '
24+ - port: 8086
2425 - status: 200
2526 - method: GET
2627 - header_dict:
@@ -29,6 +30,7 @@ get_user_{{ loop.index0 }}:
2930create_user_{{ loop.index0 }}:
3031 http.query:
3132 - name: ' https://{{ influxdb[' remote' ][' host' ] }} /api/v2/users'
33+ - port: 8086
3234 - status: 200
3335 - method: POST
3436 - data: ' {"name": "{{ name }} "}'
@@ -41,6 +43,7 @@ create_user_{{ loop.index0 }}:
4143set_password_{{ loop.index0 }}:
4244 http.query:
4345 - name: ' https://{{ influxdb[' remote' ][' host' ] }} /api/v2/users{{ name }} /password'
46+ - port: 8086
4447 - status: 200
4548 - method: POST
4649 - data: ' {"password": "{{ config["password"] }} "}'
You can’t perform that action at this time.
0 commit comments