Commit 53a7f954 authored by Erick Hitter's avatar Erick Hitter

Install service using sysv script

parent 88689bf7
--- ---
eth_log_alerting_binary_url: "https://git.ethitter.com/debian/eth-log-alerting/uploads/73fb61dcec9e953d24f1180d03959e4c/eth-log-alerting_linux_amd64" eth_log_alerting_binary_url: "https://git.ethitter.com/debian/eth-log-alerting/uploads/73fb61dcec9e953d24f1180d03959e4c/eth-log-alerting_linux_amd64"
eth_log_alerting_binary_dest: /usr/local/bin/eth-log-alerting eth_log_alerting_binary_dest: /usr/local/bin/eth-log-alerting
eth_log_alerting_init_url: "https://git.ethitter.com/debian/eth-log-alerting/raw/v0.0.1/init.sh"
eth_log_alerting_init_dest: /etc/init.d/eth-log-alerting
eth_log_alerting_init_defaults: /etc/default/eth-log-alerting
eth_log_alerting_config_dest: /etc/eth-log-alerting.json eth_log_alerting_config_dest: /etc/eth-log-alerting.json
eth_log_alerting_debug_dest: "os.Stdout" eth_log_alerting_debug_dest: "os.Stdout"
......
---
- name: Download and install binary
get_url:
url: "{{ eth_log_alerting_binary_url }}"
dest: "{{ eth_log_alerting_binary_dest }}"
mode: 0755
force: yes
- name: Set configuration
template:
src: templates/config.j2
dest: "{{ eth_log_alerting_config_dest }}"
force: yes
owner: root
group: root
mode: 0400
---
- name: Configure logrotate
template:
src: templates/logrotate.j2
dest: /etc/logrotate.d/eth-log-alerting
force: yes
owner: root
group: root
mode: 0644
when: eth_log_alerting_debug_dest != "os.Stdout"
- name: Remove logrotate configuration
file:
dest: /etc/logrotate.d/eth-log-alerting
state: absent
when: eth_log_alerting_debug_dest == "os.Stdout"
--- ---
- name: Download and install binary - include: install.yml
get_url: - include: service.yml
url: "{{ eth_log_alerting_binary_url }}" - include: logrotate.yml
dest: "{{ eth_log_alerting_binary_dest }}"
mode: 0755
force: yes
- name: Set configuration
template:
src: templates/config.j2
dest: "{{ eth_log_alerting_config_dest }}"
force: yes
owner: root
group: root
mode: 0400
- name: Configure logrotate
template:
src: templates/logrotate.j2
dest: /etc/logrotate.d/eth-log-alerting
force: yes
owner: root
group: root
mode: 0644
when: eth_log_alerting_debug_dest != "os.Stdout"
- name: Remove logrotate configuration
file:
dest: /etc/logrotate.d/eth-log-alerting
state: absent
when: eth_log_alerting_debug_dest == "os.Stdout"
---
- name: Install service
get_url:
url: "{{ eth_log_alerting_init_url }}"
dest: "{{ eth_log_alerting_init_dest }}"
mode: 0755
owner: root
group: root
force: yes
- name: Configure service
lineinfile:
dest: "{{ eth_log_alerting_init_defaults }}"
line: "{{ item }}"
mode: 0644
owner: root
group: root
state: present
create: yes
with_items:
- 'DAEMON="{{ eth_log_alerting_binary_dest }}"'
- 'DAEMON_ARGS="-config {{ eth_log_alerting_config_dest }}"'
- 'USER="root"'
- name: Ensure service is enabled and started
service:
name: eth-log-alerting
enabled: yes
state: started
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment