Melakukan deployment konfigurasi service ke systemd untuk Centos 7 ke atas menggunakan module systemd yang tersedia di ansible. Berikut contoh deployment file dan reload systemd.
- hosts: 192.168.1.1 # IP server tujuan user: root # User server tujuan tasks: - name: Copy Systemd # Nama task untuk copy copy: src: contoh.service # Kirim nama service dest: /etc/systemd/system # Path systemd centos - name: Start Service # Nama task untuk start service systemd: # Menggunakan module systemd untuk mengontrol systemd name: contoh.service # Pilih nama service state: started # Starting service daemon_reload: yes # Reload systemd service
Untuk konfigurasi service pada Centos 6.5 ke bawah dapat di lihat pada link referensi dibawah.
Referensi Link :
https://docs.ansible.com/ansible/latest/modules/systemd_module.html
https://docs.ansible.com/ansible/latest/modules/service_module.html
https://www.shellhacks.com/systemd-service-file-example/