Compare commits

..

2 Commits

Author SHA1 Message Date
587fccac64 asible 2023-12-06 19:56:44 +08:00
f757d000be binary 2023-12-06 19:49:38 +08:00
3 changed files with 54 additions and 0 deletions

43
ansible/deploy_webctl.yml Normal file
View File

@ -0,0 +1,43 @@
- name: Deploy RemoteSysManager script
hosts: all
become: yes
vars:
script_url: "http://your_script_url/webctl"
script_path: "/usr/local/bin/webctl"
systemd_service_name: "webctl.service"
systemd_service_path: "/etc/systemd/system/{{ systemd_service_name }}"
tasks:
- name: Download webctl script
ansible.builtin.get_url:
url: "{{ script_url }}"
dest: "{{ script_path }}"
mode: '0755'
- name: Create systemd service file for webctl
ansible.builtin.copy:
dest: "{{ systemd_service_path }}"
content: |
[Unit]
Description=RemoteSysManager Service
After=network.target
[Service]
Type=simple
ExecStart={{ script_path }}
Restart=on-failure
[Install]
WantedBy=multi-user.target
mode: '0644'
- name: Reload systemd daemon
ansible.builtin.systemd:
daemon_reload: yes
- name: Enable and start webctl service
ansible.builtin.systemd:
name: "{{ systemd_service_name }}"
enabled: yes
state: started

11
ansible/hosts.ini Normal file
View File

@ -0,0 +1,11 @@
[all]
server1.example.com
server2.example.com
server3.example.com
[all:vars]
ansible_user=user
ansible_ssh_pass=pass
ansible_become=true
ansible_become_method=sudo
ansible_become_pass=pass

BIN
webctl Normal file

Binary file not shown.