ansible-edda/playbooks/tasks/services/deploy/service/02-veth.yml

42 lines
1.4 KiB
YAML
Raw Normal View History

- name: Configure veth interface for user {{ service_user_name }}
template:
src: "./filesystem/common/etc/network/interfaces.d/veth-_service.j2"
dest: "/etc/network/interfaces.d/{{ service_iface_name }}"
mode: 0644
validate: >
bash -c
'export NEWIF=%s;
if ! diff ${NEWIF} /etc/network/interfaces.d/{{ service_iface_name }} &&
ip link show dev {{ service_iface_name }} ;
then
ifdown {{ service_iface_name }} && ifup -i ${NEWIF} {{ service_iface_name }} ;
fi'
register: veth_service_intf
- name: Configure connect-pod-service
copy:
src: "./filesystem/common/etc/systemd/system/connect-pod-service@.service"
dest: "/etc/systemd/system/connect-pod-service@.service"
mode: 0644
register: systemd_connect_pod_service_service
- name: Configure connect-pod-service path trigger
template:
src: "./filesystem/common/etc/systemd/system/connect-pod-service@.path.j2"
dest: "/etc/systemd/system/connect-pod-service@.path"
mode: 0644
register: systemd_connect_pod_service_path
- name: SystemD daemon reload
systemd:
daemon_reload: true
when:
systemd_connect_pod_service_service is changed or
systemd_connect_pod_service_path is changed
- name: Enable the path trigger service for {{ service_name }}
systemd:
name: "connect-pod-service@{{ service_name }}.path"
enabled: yes
state: started