fix: disable become on localhost play and drop deprecated facts
Use now() for export timestamps and ansible_facts['system'] for browser detection. Set become: false on the localhost play to avoid sudo on local fact gathering.
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
hosts: localhost
|
hosts: localhost
|
||||||
connection: local
|
connection: local
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
|
become: false
|
||||||
tags: [install, update, export]
|
tags: [install, update, export]
|
||||||
tasks:
|
tasks:
|
||||||
- name: Generate global index.html and open in browser
|
- name: Generate global index.html and open in browser
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
dest: "{{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/index.html"
|
dest: "{{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/index.html"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
vars:
|
vars:
|
||||||
generated_at: "{{ ansible_date_time.date }} {{ ansible_date_time.time }}"
|
generated_at: "{{ now(utc=false, fmt='%Y-%m-%d %H:%M:%S') }}"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
dest: "{{ hysteria2_output_dir }}/index.html"
|
dest: "{{ hysteria2_output_dir }}/index.html"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
vars:
|
vars:
|
||||||
generated_at: "{{ ansible_date_time.date }} {{ ansible_date_time.time }}"
|
generated_at: "{{ now(utc=false, fmt='%Y-%m-%d %H:%M:%S') }}"
|
||||||
total_users: "{{ hysteria2_global_servers | map(attribute='users') | map('length') | sum }}"
|
total_users: "{{ hysteria2_global_servers | map(attribute='users') | map('length') | sum }}"
|
||||||
when: hysteria2_global_servers | default([]) | length > 0
|
when: hysteria2_global_servers | default([]) | length > 0
|
||||||
become: false
|
become: false
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
when:
|
when:
|
||||||
- hysteria2_open_browser | bool
|
- hysteria2_open_browser | bool
|
||||||
- hysteria2_global_servers | default([]) | length > 0
|
- hysteria2_global_servers | default([]) | length > 0
|
||||||
- ansible_system == 'Darwin'
|
- ansible_facts['system'] == 'Darwin'
|
||||||
changed_when: false
|
changed_when: false
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
when:
|
when:
|
||||||
- hysteria2_open_browser | bool
|
- hysteria2_open_browser | bool
|
||||||
- hysteria2_global_servers | default([]) | length > 0
|
- hysteria2_global_servers | default([]) | length > 0
|
||||||
- ansible_system == 'Linux'
|
- ansible_facts['system'] == 'Linux'
|
||||||
changed_when: false
|
changed_when: false
|
||||||
become: false
|
become: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|||||||
Reference in New Issue
Block a user