Updated paths for copr ansible scripts

This commit is contained in:
gezimbll
2023-03-21 09:29:10 -04:00
committed by Dan Christian Bogos
parent 1bc7ddc712
commit d57b6adaa6
3 changed files with 24 additions and 24 deletions

View File

@@ -1,15 +1,15 @@
{{ ansible_managed | comment }}
[Unit]
Description=Copr Custom Webhook Server
ConditionPathExists={{ copr_hooks_dir }}
Description= Gateway between REST and Copr to add multiple branches support in Copr builds
ConditionPathExists={{ coprgate_dir }}
After=network.target
[Service]
Environment="V10={{ v10 }}" "MASTER={{ nightly }}"
ExecStart=/usr/local/bin/copr-hooks-server
ExecStart=/usr/local/bin/{{ service_name }}
Restart=on-failure
RestartSec=10
StandardOutput=syslog
StandardError=syslog
StandardOutput=journal
StandardError=journal
SyslogIdentifier={{ service_name }}
[Install]
WantedBy=multi-user.target

View File

@@ -15,9 +15,9 @@
# Filename of Go language SDK redistributable package
golang_redis_filename: 'go{{ golang_version }}.linux-amd64.tar.gz'
copr_hooks_dir: "/home/{{ user }}/go/src/github.com/copr-hooks"
copr_hook_bin: "{{ golang_gopath }}/bin/copr-hooks-server"
service_name: coprhooks
coprgate_dir: "/home/{{ user }}/go/src/github.com/coprgate"
coprgate_bin: "{{ golang_gopath }}/bin/coprgate"
service_name: coprgate
tasks:
@@ -31,37 +31,37 @@
- name: Install golang
include: go.yaml
- name: Create copr-hooks directory
- name: Create coprgate directory
become: yes
file:
state: directory
mode: 'u=rwx,go=rx'
owner: "{{ user }}"
group: "{{ user }}"
dest: '{{ copr_hooks_dir }}'
dest: '{{ coprgate_dir }}'
become_user: "{{ user }}"
- name: Clone Copr-Webhooks from github repository
- name: Clone coprgate from github repository
git:
repo: https://github.com/gezimbll/Copr-WebHook.git
dest: '{{ copr_hooks_dir }}'
repo: https://github.com/cgrates/coprgate.git
dest: '{{ coprgate_dir }}'
update: yes
force: yes
become: yes
- name: Install copr-hooks
shell: "go install copr-hooks-server.go"
- name: Install coprgate
shell: "go install coprgate.go"
environment:
PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}"
args:
chdir: '{{ copr_hooks_dir }}'
chdir: '{{ coprgate_dir }}'
- name: Copy copr-hooks to system executable
- name: Copy coprgate to system executable
become: yes
copy:
src: "{{ copr_hook_bin }}"
src: "{{ coprgate_bin }}"
remote_src: true
dest: "/usr/local/bin"
unsafe_writes: yes
@@ -69,22 +69,22 @@
- name: Changing the permissions
become: yes
file:
path: /usr/local/bin/copr-hooks-server
path: /usr/local/bin/{{ service_name }}
owner: root
mode: 0755
- name: Create the service file
become: yes
template:
src: copr-hooks.service.j2
dest: /etc/systemd/system/copr-hooks.service
src: coprgate.service.j2
dest: /etc/systemd/system/coprgate.service
- name: Reload daemon and start the service
become: yes
ansible.builtin.systemd:
state: started
daemon_reload: true
name: copr-hooks.service
name: coprgate.service
enabled: true
- name: Create directory for reading logs
@@ -104,8 +104,8 @@
- name: Create the log file
become: yes
template:
src: coprhooks.conf.j2
dest: /etc/rsyslog.d/coprhooks.conf
src: coprgate.conf.j2
dest: /etc/rsyslog.d/coprgate.conf
- name: Restart rsyslog
become: yes