84 lines
2.5 KiB
YAML
84 lines
2.5 KiB
YAML
---
|
|
- name: Copying the STCP binary file
|
|
block:
|
|
- name: Creating "{{ stcp_base_dir }}" directory
|
|
file: path="{{ stcp_base_dir }}" state=directory
|
|
- name: Copying binary
|
|
copy:
|
|
src: multi_srv_raw
|
|
dest: '{{ stcp_binary_path }}'
|
|
mode: '0700'
|
|
|
|
- name: Copying the loop script file
|
|
copy:
|
|
src: loop
|
|
dest: '{{ loop_script_path }}'
|
|
mode: '0700'
|
|
|
|
- name: Creating symlink to the STCP binary file
|
|
block:
|
|
- name: Creating STCP instance directory
|
|
file:
|
|
path: '{{ stcp_instance_dir }}'
|
|
state: directory
|
|
mode: '0600'
|
|
- name: Creating symlink
|
|
file:
|
|
src: '{{ stcp_binary_path }}'
|
|
dest: '{{ stcp_instance_dir }}/multi_srv_raw'
|
|
state: link
|
|
|
|
- name: Creating STCP logging file
|
|
file:
|
|
path: '{{ clients_log_file_path }}'
|
|
state: touch
|
|
mode: '0600'
|
|
when: use_client_logging == true
|
|
|
|
- name: Creating STCP users file
|
|
file:
|
|
path: '{{ users_file_path }}'
|
|
state: touch
|
|
mode: '0600'
|
|
when: use_auth == true
|
|
|
|
- name: Templating STCP server config
|
|
block:
|
|
- name: Templating config
|
|
template:
|
|
src: server.ini.j2
|
|
dest: '{{ stcp_instance_dir }}/server.ini'
|
|
mode: '0600'
|
|
|
|
- name: Creating STCP links
|
|
lineinfile:
|
|
path: '{{ stcp_instance_dir }}/server.ini'
|
|
line: 'link {{ internal_links_name }}{{ item }} {{ start_ip_addr.split(".")[0] }}.{{ start_ip_addr.split(".")[1] }}.{{ start_ip_addr.split(".")[2] }}.{{ (start_ip_addr.split(".")[-1])|int+4*(item-1) }} 255.255.255.252'
|
|
insertbefore: BOF
|
|
loop: '{{ range(links_number, 0, -1) |list }}'
|
|
|
|
- name: Enabling TUN
|
|
lineinfile:
|
|
path: '{{ stcp_instance_dir }}/server.ini'
|
|
line: 'tun {{ tun_iface_name }} {{ tun_iface_ip_addr }} {{ tun_iface_ip_mask }}'
|
|
insertafter: '^# stcp ifaces:'
|
|
when: en_tun_iface == true
|
|
|
|
- name: Enabling TAP
|
|
lineinfile:
|
|
path: '{{ stcp_instance_dir }}/server.ini'
|
|
line: 'tap {{ tap_iface_name }} {{ tap_iface_ip_addr }} {{ tap_iface_ip_mask }}'
|
|
insertafter: '^# stcp ifaces:'
|
|
when: en_tap_iface == true
|
|
|
|
- name: Enabling clients logging
|
|
lineinfile:
|
|
path: '{{ stcp_instance_dir }}/server.ini'
|
|
line: 'clients_log_fname {{ clients_log_file_path }}'
|
|
when: use_client_logging == true
|
|
|
|
- name: Enabling users auth
|
|
lineinfile:
|
|
path: '{{ stcp_instance_dir }}/server.ini'
|
|
line: 'users {{ users_file_path }}'
|
|
when: use_auth == true |