Update VMware setup
This commit is contained in:
parent
17e0a6854a
commit
7843283f5e
|
@ -29,6 +29,12 @@
|
||||||
- "os_defaut.yml"
|
- "os_defaut.yml"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Disable VMware timesync
|
||||||
|
shell: 'vmware-toolbox-cmd timesync disable'
|
||||||
|
changed_when: False
|
||||||
|
when: ansible_virtualization_type|lower == "vmware"
|
||||||
|
|
||||||
|
|
||||||
- include_tasks: "timesync_{{ timesync_daemon }}.yml"
|
- include_tasks: "timesync_{{ timesync_daemon }}.yml"
|
||||||
|
|
||||||
|
|
||||||
|
|
28
timesync.yml
28
timesync.yml
|
@ -17,14 +17,13 @@
|
||||||
|
|
||||||
|
|
||||||
# Debugging only
|
# Debugging only
|
||||||
- hosts: localhost
|
- hosts: all
|
||||||
|
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- debug:
|
- set_fact:
|
||||||
var: groups
|
timesync_force: timesync_servers is defined or timesync_pools is defined
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Hosts: Install/Configure NTP
|
### Hosts: Install/Configure NTP
|
||||||
|
@ -95,20 +94,19 @@
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Get timesync status
|
- name: Check for vmware-toolbox-cmd
|
||||||
command: vmware-toolbox-cmd timesync status
|
stat:
|
||||||
changed_when: False
|
path: /usr/bin/vmware-toolbox-cmd
|
||||||
register: vmwtbcmd_timesync
|
register: vmwtbcmd
|
||||||
ignore_errors: True
|
|
||||||
|
|
||||||
- name: Install Open-VM-Tools
|
- name: Install Open-VM-Tools
|
||||||
package:
|
package:
|
||||||
name: open-vm-tools
|
name: open-vm-tools
|
||||||
state: present
|
state: present
|
||||||
when: vmwtbcmd_timesync|failed
|
when: vmwtbcmd.stat.exists == False
|
||||||
|
|
||||||
- name: Get timesync status AGAIN
|
- name: Get timesync status
|
||||||
command: vmware-toolbox-cmd timesync status
|
shell: 'vmware-toolbox-cmd timesync status || true'
|
||||||
changed_when: False
|
changed_when: False
|
||||||
register: vmwtbcmd_timesync
|
register: vmwtbcmd_timesync
|
||||||
|
|
||||||
|
@ -117,8 +115,10 @@
|
||||||
- vmwtbcmd_timesync.stdout in ["Enabled", "Disabled"]
|
- vmwtbcmd_timesync.stdout in ["Enabled", "Disabled"]
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: timesync-disabled, when: vmwtbcmd_timesync.stdout == "Disabled" }
|
- role: timesync-disabled
|
||||||
- { role: timesync-enabled, when: vmwtbcmd_timesync.stdout == "Enabled"}
|
when: vmwtbcmd_timesync.stdout == "Enabled" and not timesync_force
|
||||||
|
- role: timesync-enabled
|
||||||
|
when: vmwtbcmd_timesync.stdout == "Disabled" or timesync_force
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue