ansible启动Sersync
时间: 2023-09-19 15:07:23 浏览: 107
要在ansible中启动Sersync,首先需要在ansible服务器上下载Sersync,并将其解压到/etc/ansible/ansible_playbook/目录,并修改配置文件。接下来,将Sersync推送到nfs服务器。最后,通过执行命令启动Sersync。具体的步骤如下所示:
1. 在ansible服务器上下载Sersync,并解压到/etc/ansible/ansible_playbook/目录,并修改配置文件。可以使用以下命令完成此步骤:
```
[root@ansible ansible_playbook]# cd tools/
[root@ansible tools]# rz -E
[root@ansible tools]# tar zxf sersync2.5.4_64bit_binary_stable_final.tar.gz
[root@ansible tools]# mv GNU-Linux-x86/ sersync
[root@ansible tools]# cd sersync/
[root@ansible sersync]# ls confxml.xml sersync2
[root@ansible sersync]# cd ../..
[root@ansible ansible_playbook]# vim /etc/ansible/ansible_playbook/sersync.yaml
```
2. 在sersync.yaml文件中添加以下内容:
```
- hosts: nfs
tasks:
- name: scp sersync
copy: src=./tools/sersync/ dest=/usr/local/sersync owner=www group=www mode=755
- name: start sersync
shell: pgrep sersync; [ $? -eq 0 ] || /usr/local/sersync/sersync2 -dro /usr/local/sersync/confxml.xml
```
3. 最后,使用ansible-playbook命令执行sersync.yaml文件以启动Sersync:
```
[root@ansible ansible_playbook]# ansible-playbook -C sersync.yaml
```
这样,ansible就会在指定的nfs服务器上启动Sersync。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [ansible(二)](https://blog.csdn.net/weixin_46715997/article/details/117133598)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [架构——17——Ansible playbook(web-nfs-rsync)](https://blog.csdn.net/weixin_45373345/article/details/107366528)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文