playbooks/roles/vhosts/billing-service/tasks/main.yml
2026-04-12 19:05:17 +08:00

52 lines
1.5 KiB
YAML

- name: Create billing-service directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ billing_service_user }}"
group: "{{ billing_service_group }}"
mode: "0755"
loop:
- "{{ billing_service_app_dir }}"
- "{{ billing_service_env_dir }}"
- name: Deploy billing-service binary artifact
ansible.builtin.copy:
src: "{{ billing_service_binary_artifact }}"
dest: "{{ billing_service_binary_path }}"
owner: "{{ billing_service_user }}"
group: "{{ billing_service_group }}"
mode: "0755"
notify: Restart billing-service
- name: Ensure billing-service binary permissions
ansible.builtin.file:
path: "{{ billing_service_binary_path }}"
owner: "{{ billing_service_user }}"
group: "{{ billing_service_group }}"
mode: "0755"
- name: Deploy billing-service environment file
ansible.builtin.template:
src: billing-service.env.j2
dest: "{{ billing_service_env_path }}"
owner: root
group: root
mode: "0600"
notify: Restart billing-service
- name: Install billing-service systemd service
ansible.builtin.template:
src: billing-service.service.j2
dest: "/etc/systemd/system/{{ billing_service_service_name }}.service"
owner: root
group: root
mode: "0644"
notify: Restart billing-service
- name: Enable and start billing-service
ansible.builtin.systemd:
name: "{{ billing_service_service_name }}"
enabled: true
state: started
daemon_reload: true