1 Star 2 Fork 1

Sajor / auto-install

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.35 KB
一键复制 编辑 原始数据 按行查看 历史

sync-time

此模块用于修改服务器的时区,并与时间服务器同步时间

Requirements

需要提前配置好时间服务器,如果没有可以使用install-chrony模块来安装一台,也可以配置现有的 默认使用资产清单中的 time-server.time-server01.ansible_host

需要先配置好yum源,模块使用yum来下载ntpdate

Role Variables

vars/main.yml

# 默认的时间服务器ip
time_server_host: "{{ hostvars['time-server01']['ansible_host'] }}"

Dependencies

  • install-common-tools

Example

Playbook

- hosts: 172.38.1.230
  remote_user: root 
  roles:
  - role: sync-time

  - { role: change-hosts, time_server_host: 172.38.4.1 }

Command line

usage: command.py sync-time [-h] [--time_server_host TIME_SERVER_HOST] hosts

positional arguments:
  hosts                 资产主机组-资产清单中维护

options:
  -h, --help            show this help message and exit
  --time_server_host TIME_SERVER_HOST
                        时间服务器ip地址,默认为主机清单中time-server01
  --inventory INVENTORY
                        指定inventory文件路径

License

BSD

Author Information

Sajor Gitee

1
https://gitee.com/Sajor-Dino/auto-install.git
git@gitee.com:Sajor-Dino/auto-install.git
Sajor-Dino
auto-install
auto-install
main

搜索帮助