Update VMware setup
This commit is contained in:
parent
17e0a6854a
commit
7843283f5e
|
@ -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"
|
||||
|
||||
|
||||
|
|
28
timesync.yml
28
timesync.yml
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue