Update VMware setup

This commit is contained in:
Sven Velt 2020-12-02 22:44:01 +01:00
parent 17e0a6854a
commit 7843283f5e
2 changed files with 20 additions and 14 deletions

View file

@ -29,6 +29,12 @@
- "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"

View file

@ -17,14 +17,13 @@
# Debugging only
- hosts: localhost
- hosts: all
gather_facts: no
tasks:
- debug:
var: groups
- set_fact:
timesync_force: timesync_servers is defined or timesync_pools is defined
### Hosts: Install/Configure NTP
@ -95,20 +94,19 @@
gather_facts: no
pre_tasks:
- name: Get timesync status
command: vmware-toolbox-cmd timesync status
changed_when: False
register: vmwtbcmd_timesync
ignore_errors: True
- name: Check for vmware-toolbox-cmd
stat:
path: /usr/bin/vmware-toolbox-cmd
register: vmwtbcmd
- name: Install Open-VM-Tools
package:
name: open-vm-tools
state: present
when: vmwtbcmd_timesync|failed
when: vmwtbcmd.stat.exists == False
- name: Get timesync status AGAIN
command: vmware-toolbox-cmd timesync status
- name: Get timesync status
shell: 'vmware-toolbox-cmd timesync status || true'
changed_when: False
register: vmwtbcmd_timesync
@ -117,8 +115,10 @@
- vmwtbcmd_timesync.stdout in ["Enabled", "Disabled"]
roles:
- { role: timesync-disabled, when: vmwtbcmd_timesync.stdout == "Disabled" }
- { role: timesync-enabled, when: vmwtbcmd_timesync.stdout == "Enabled"}
- role: timesync-disabled
when: vmwtbcmd_timesync.stdout == "Enabled" and not timesync_force
- role: timesync-enabled
when: vmwtbcmd_timesync.stdout == "Disabled" or timesync_force