Ansible deployment based on Windows R2+rsync+alwaysup (daemon)

Source: Internet
Author: User
Tags vars rsync

Preparing: upgrading PowerShell3.0 and opening the WinRM module reference article: http://juestnow.blog.51cto.com/1515305/1875026

Download Package rsync http://down.51cto.com/data/371729

Alwaysup https://www.coretechnologies.com/products/AlwaysUp/

ALWAYSUPCLT https://www.coretechnologies.com/products/AlwaysUp/AlwaysUpCLT/

Inno Setup http://www.jrsoftware.org/isinfo.php native installation production ALWAYSUPCLT installation package

rsync server files are used synchronously, the Alwaysup Daemon tool application starts using in order to safely not provide installation files

1. Ansible directory structure

├── alwaysup│   └── daemon_alwaysup.xml.j2  #alwaysup添加apps模板 ├──  alwaysupclt.iss # alwaysupclt  installation package   Official offer is ZIP package  ansible  Replace file problem many made EXE silent installation faster ├──  alwaysUp.retry # ansible  run the resulting Hosts file ├── alwaysup.yml #  using ansible  Import alwaysup template file ├── hosts #  server IP storage file ├── roles│   ├── alwaysup │    │   ├── defaults│   │   ├── files│    │   │   ├── AlwaysUpCLT.exe  #客户机安装使用 │    │   │   └── AlwaysUp_Installer.exe  #客户机安装使用 │   │    ├── handlers│   │   ├── meta│   │    ├── tasks│   │   │   └── main.yml   #ansible   Install daemon files │   │   ├── templates│   │   └── vars│   └──  cwRsyncServer│       ├── defaults│        ├── files│       │   ├── cwrsyncserver _4.1.0_installer.exe # rsync  Server installation files │       │ │        ├── handlers│       ├── meta│        ├── tasks│       │    └── main.yml  #ansible   Install rsync file │       ├──  templates│       │   └── rsyncd.conf.j2 #  rsync  Server configuration file │       └── vars├── site.retry #  ansible  run generated by the hostsFile ├── site.yml  # ansible  installation daemon and rsync server using └── win_env.bat #  environment variable file  ansible  Operations  windows  Environment variables It's a lot of trouble to get through
site.yml  Description:- hosts:  ' {{host} '   #变量安装服务器别名  # gather_facts: false #   Whether to get the client's setup variables   deployment software recommendations Comment out   vars:    rsync_port: 9999 #  rsync  server ports     rsync_node: test #  Access rsync path tags      rsync_path: c/test # rsync  Server Configuration Path     sync_file: c:\test  #  Create rsync  Server data path     rsync_ip: 192.168.0.210 ,  192.168.7.233 # rsync  server allows access to ip    win_env: c:\windows\system32; C:\Windows; C:\Windows\System32\Wbem; c:\windows\system32\windowspowershell\v1.0\ #  using the ansible  operating environment variable default system environment variables each server environment variable is not common this case is not used     rsync_env: c:\ "program files  (x86)" \icw\bin # rsync  Path variable     alwaysup_env: c:\ "program files  (x86)" \alwaysup #  Alwaysup  path  variables   roles:    - cwRsyncServer  #ansible   installation   cwrsyncserver      - alwaysup  #ansible   Installation alwaysup    tasks:    - name: evn       #win_environment:   #ansible   Operation windows  environment variable            # state: present         #name: path          #value:  ' {{ win_env }}; ' {{ rsync_env }} ";" {{ alwaysup_env }} "'          #level: machine       # when:  ( rsync_path_register.stat.exists == False )  and  (Alwaysup_path_register.stat.exists == false)        script: win_env.bat {{ rsync_env }} {{ alwaysup_env }} #  using scripting OS environment variables       when:  (  rsync_path_register.stat.exists == False )  and  (alwaysup_path_ Register.stat.exists == false)

Alwaysup installation File description

- win_stat: path= ' c:/program files  (x86)/alwaysup '   #获取是否安装路径   register:  alwaysup_path_register- win_stat: path= ' c:/temp '   #获取是否创建  c:/temp  register : temp_path_register- name: create c:\temp to  client  raw:    ' cmd /c  ' mkdir  c:\temp  '  #  create c:/temp  if not   when:  temp_path_register.stat.exists == False   #copy  AlwaysUp_Installer.exe  config to client- win_copy: src={{ item }} dest=c:/temp/{{ item } } #  uploading files to the client C:/temp  with_items:     - alwaysup_ Installer.exe     - alwaysupclt.exe  when: alwaysup_path_ register.stat.exists == false- name: intsatll alwaysup to clien #   Installation alwaysup   raw: c:/Temp/alwaysup_installer.exe  /sp- /verysilent /norestart  when: alwaysup_ Path_register.stat.exists == false- name: intsatll alwaysupclt to clien  #  installation alwaysupclt  raw: c:/temp/alwaysupclt.exe /verysilent -sp   when: alwaysup_path_register.stat.exists == false- name: rd c:\temp  Delete  c:\temp  files   raw: CMD /C  ' del /s /q /f c:\temp\*.* '   when: alwaysup_path_register.stat.exists == false

Cwrsyncserver Description

- win_stat: path= ' c:/program files  (x86)/icw/bin '  #  determine if rsync   is installed Register: rsync_path_register- win_stat: path= ' c:/temp '  #  decide whether to create  C:/temp   register: temp_path_register- name: create c:\temp to  client   raw:   ' cmd /c  ' mkdir  c:\temp     #没有就创建C:/temp  when:  temp_path_register.stat.exists == False   #create  c:\{{ sync_file }}  rsyncserver to clien- win_file: path={{ sync_file }} state=directory  #  Create rsync  data storage folder   when: rsync_path_register.stat.exists == false    #copy  rsync config to client- win_copy: src=cwrsyncserver_4.1.0_ installer.exe dest=c:/temp/cwrsyncserver_4.1.0_installer.exe #  uploading rsync  installation files    When: rsync_path_register.staT.exists == false- name: intsatll rsyncserver to clien  raw:  CMD /C  ' c:\temp\cwrsyncserver_4.1.0_installer.exe /s '  #  install rsync services   File name changed please modify script file   when: rsync_path_register.stat.exists == False   #cp   rsyncd.conf #  uploading rsync  configuration file- win_template:    src=\ ' #\ ' "/C  ' Del  /s /q /f c:\temp\*.* '  #  Delete  c:\temp  file   when: rsync_ Path_register.stat.exists == false

Alwaysup.yml Description

- hosts:  ' {{host} '  # host  tags    #gather_facts:  false  vars:    daemon_ver: 9.7.2.88 # AlwaysUp  version Good Apps xml file used to      daemon_name: notepad # AlwaysUp  Friendly name    daemon_path: c:\windows\ system32\notepad.exe #  Server boot path absolute path    daemon_parameter:  #  file startup parameters such as:. \.\ test.ini -d  Parameters   tasks:    - win_file: path=c:/alwaysUp  state=directory #  Create Appsxml file Folder     - win_template:           src=\ ' #\ ' "/daemon_alwaysup.xml.j2 #  upload  apps  file          dest:  ' C:/alwaysup/{{ daemon_name }}_ Alwaysup.xml '     - name: Import  ' {{ daemon_name }} ' _alwaysup.xml       raw: cmd /c  ' installservice.exe -xml c:\alwaysup\{{ daemon_name  }}_alwaysup.xml '   Import xml  to  alwaysUp  daemon

Rsync uses simple instructions:

Uploading files to rsync server cd/d C:\Program files (x86) \cwrsync\binrsync--port=9999-rvzc--ignore-errors--no-iconv--delete-- Progress--exclude-from= '/cygdrive/f/scripts/exclude ' exclude file configuration/cygdrive/f/test/Local address rsync://192.168.1.19/test/ Server path Download rsync file cd/d C:\Program files (x86) \cwrsync\binrsync--port=9999-rvzc--ignore-errors--no-iconv--delete--prog Ress--exclude-from= '/cygdrive/f/scripts/exclude ' Exclude file Configuration rsync://192.168.1.19/test/Server path/cygdrive/f/test/Local address You can use Jenkins to push files to the server or you can use Ansible to pull files

Alwaysup Instructions for use:

UninstallService.exe "Test" # Delete daemon appsinstallservice.exe-xml c:\test_alwaysup.xml # import Apps Daemon AlwaysUp.exe- Start-all-in-current-session # Start All Programs and display Interface Alwaysup.exe-start-all # start All Programs AlwaysUp.exe- Restart-all-in-current-session # Restart All Programs alwaysup.exe-start-in-current-session "Test" # Start a program and display the interface if there is a AlwaysUp.exe- Start-in "Test" #启动摸个程序AlwaysUp. Exe-restart-in-current-session "Test" #重启某个程序并显示界面 if there is Alwaysup.exe-restart "test" # Restart a program alwaysup.exe-stop "test" #关闭某个程序AlwaysUp. Exe-stop-all # Close all program daemons not guarding

Alwaysupclt.iss Description:

;------------------------------------------------;;              ALWAYSUPCLT installation script;---------------- --------------------------------[Setup]; Company Information appname=alwaysupcltupcltappvername=alwaysupcltapppublisher= Www.coretechnologies.comAppCopyright=www.coretechnologies.comAppPublisherURL=www.coretechnologies.comAppId  =www.coretechnologies.com; version Information versioninfoversion=6.0.1.0versioninfodescription= "ALWAYSUPCLTUPCLT"; installation directory defaultdirname=c:\program files  (x86) \alwaysup #  installation path DEFAULTGROUPNAME=ALWAYSUPCLTUPCLT Output configuration outputdir= d:\ Desktop \aa #  packaging output exe  path sourcedir= d:\ Desktop \aa\alwaysupclt #  Package source path outputbasefilename=alwaysupclt #  package generated EXE file name; compile Options compression=zip/9 #  Compression ratio solidcompression=yes; Environment Option uninstallable=nodisabledirpage=yescreateuninstallregkey=nousepreviousappdir=no[ Files]; alwaysupcltsource:  "AlwaysUpService.exe"; destdir:  "{app}";  flags: ignoreversionsource:  "InstallService.exe"; destdir:  "{app}";  flags: ignoreversionsource:   "UninstallService.exe"; destdir:  "{app}"; flags: ignoreversionsource:  " EventMessageFile.dll "; destdir: " {app} "; flags: ignoreversionsource: " GHCrUtils.dll ";  DestDir:  "{app}"; flags: ignoreversionsource:  "xml\*"; destdir:  "{App}\xml \ "; flags: ignoreversion recursesubdirs createallsubdirssource: " SanityCheck\* ";  DestDir:  "{app}\sanitycheck\"; flags: ignoreversion recursesubdirs  createallsubdirssource:  "documentation\*"; destdir:  "{app}\documentation\"; Flags:  Ignoreversion recursesubdirs createallsubdirs

Other:

Import host=test daemon Apps profile using Ansible installer Ansible-playbook-i hosts Site.yml-verbose--extra-vars "Alwaysup (Hosts file configuration node)" Ansible-playbook-i hosts Alwaysup.yml-verbose--extra-vars "Host=test daemon_name=calc daemon_path=C:\Windows\  System32\calc.exe daemon_parameter=-a "Force the use of external parameters so that you can randomly create launch apps XML template files can also be modified according to their own situation to add mail alarm port monitoring and so on.  Alwaysup Registration machine with accessories recommended to run on the local computer without copying to the server. All scripts placed in attachments


This article is from the "Growth record" blog, so be sure to keep this source http://juestnow.blog.51cto.com/1515305/1876125

Ansible deployment based on Windows R2+rsync+alwaysup (daemon)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.