|
4 | 4 | service: name={{instance_init_script | basename}} state=started enabled=yes
|
5 | 5 |
|
6 | 6 | - name: Wait for elasticsearch to startup
|
7 |
| - wait_for: port={{es_api_port}} delay=10 |
| 7 | + wait_for: host={% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %} port={% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %} delay=10 |
8 | 8 |
|
9 | 9 | - set_fact: manage_native_users=false
|
10 | 10 |
|
|
21 | 21 | #List current users
|
22 | 22 | - name: List Native Users
|
23 | 23 | uri:
|
24 |
| - url: http://{{es_api_host}}:{{es_api_port}}/_shield/user |
| 24 | + url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/user |
25 | 25 | method: GET
|
26 | 26 | user: "{{es_api_basic_auth_username}}"
|
27 | 27 | password: "{{es_api_basic_auth_password}}"
|
|
42 | 42 | #Delete all non required users
|
43 | 43 | - name: Delete Native Users
|
44 | 44 | uri:
|
45 |
| - url: http://{{es_api_host}}:{{es_api_port}}/_shield/user/{{item}} |
| 45 | + url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/user/{{item}} |
46 | 46 | method: DELETE
|
47 | 47 | status_code: 200
|
48 | 48 | user: "{{es_api_basic_auth_username}}"
|
|
55 | 55 | #Overwrite all other users
|
56 | 56 | - name: Update Native Users
|
57 | 57 | uri:
|
58 |
| - url: http://{{es_api_host}}:{{es_api_port}}/_shield/user/{{item.key}} |
| 58 | + url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/user/{{item.key}} |
59 | 59 | method: POST
|
60 | 60 | body_format: json
|
61 | 61 | body: "{{item.value | to_json}}"
|
|
70 | 70 |
|
71 | 71 | - name: List Native Roles
|
72 | 72 | uri:
|
73 |
| - url: http://{{es_api_host}}:{{es_api_port}}/_shield/role |
| 73 | + url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/role |
74 | 74 | method: GET
|
75 | 75 | body_format: json
|
76 | 76 | user: "{{es_api_basic_auth_username}}"
|
|
94 | 94 | #Delete all non required roles
|
95 | 95 | - name: Delete Native Roles
|
96 | 96 | uri:
|
97 |
| - url: http://{{es_api_host}}:{{es_api_port}}/_shield/role/{{item}} |
| 97 | + url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/role/{{item}} |
98 | 98 | method: DELETE
|
99 | 99 | status_code: 200
|
100 | 100 | user: "{{es_api_basic_auth_username}}"
|
|
107 | 107 | #Update other roles
|
108 | 108 | - name: Update Native Roles
|
109 | 109 | uri:
|
110 |
| - url: http://{{es_api_host}}:{{es_api_port}}/_shield/role/{{item.key}} |
| 110 | + url: http://{% if es_config['network.host'] is defined %}{{es_config['network.host']}}{% else %}{{es_api_host}}{% endif %}:{% if es_config['http.port'] is defined %}{{es_config['http.port']}}{% else %}{{es_api_port}}{% endif %}/_shield/role/{{item.key}} |
111 | 111 | method: POST
|
112 | 112 | body_format: json
|
113 | 113 | body: "{{item.value | to_json}}"
|
|
117 | 117 | force_basic_auth: yes
|
118 | 118 | when: manage_native_roles and es_roles.native.keys() > 0
|
119 | 119 | with_dict: "{{es_roles.native}}"
|
120 |
| - |
121 |
| - |
122 |
| - |
0 commit comments