asible
This commit is contained in:
parent
f757d000be
commit
587fccac64
43
ansible/deploy_webctl.yml
Normal file
43
ansible/deploy_webctl.yml
Normal 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
11
ansible/hosts.ini
Normal 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
|
Loading…
Reference in New Issue
Block a user