mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-26 15:55:56 +02:00
Update to 2022-08-19 16:00
This commit is contained in:
13
roles/linstor_gateway/tasks/conf.yml
Normal file
13
roles/linstor_gateway/tasks/conf.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
- name: Configure Linstor Gateway
|
||||
template: src=linstor-gateway.toml.j2 dest=/etc/linstor-gateway/linstor-gateway.toml
|
||||
notify: restart linstor-gateway
|
||||
tags: drbd
|
||||
|
||||
- name: Install linstor-gateway completion
|
||||
shell: linstor-gateway completion > /etc/bash_completion.d/linstor_gateway
|
||||
args:
|
||||
creates: /etc/bash_completion.d/linstor_gateway
|
||||
tags: drbd
|
||||
|
6
roles/linstor_gateway/tasks/directories.yml
Normal file
6
roles/linstor_gateway/tasks/directories.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
- name: Create linstor-gateway conf dir
|
||||
file: path=/etc/linstor-gateway state=directory
|
||||
tags: drbd
|
||||
|
35
roles/linstor_gateway/tasks/facts.yml
Normal file
35
roles/linstor_gateway/tasks/facts.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
|
||||
# Load distribution specific variables
|
||||
- include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ role_path }}/vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
|
||||
- "{{ role_path }}/vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
|
||||
- "{{ role_path }}/vars/{{ ansible_distribution }}.yml"
|
||||
- "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
|
||||
tags: drbd
|
||||
|
||||
- set_fact: lingw_install_mode='none'
|
||||
tags: drbd
|
||||
|
||||
- name: Check if linstor-gateway is installed
|
||||
stat: path=/usr/local/bin/linstor-gateway
|
||||
register: lingw_bin
|
||||
tags: drbd
|
||||
|
||||
- when: not lingw_bin.stat.exists
|
||||
set_fact: lingw_install_mode='install'
|
||||
tags: drbd
|
||||
|
||||
- when: lingw_bin.stat.exists
|
||||
block:
|
||||
- name: Detect installed version
|
||||
shell: linstor-gateway version | perl -ne 'm/version (\d+(\.\d+)*)/ && print "$1\n"'
|
||||
changed_when: False
|
||||
register: lingw_current_version
|
||||
- set_fact: lingw_current_version={{ lingw_current_version.stdout }}
|
||||
tags: drbd
|
||||
|
||||
- when: lingw_bin.stat.exists and lingw_current_version != lingw_version
|
||||
set_fact: lingw_install_mode='upgrade'
|
||||
tags: drbd
|
22
roles/linstor_gateway/tasks/install.yml
Normal file
22
roles/linstor_gateway/tasks/install.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
|
||||
- name: Install linstor-gateway
|
||||
get_url:
|
||||
url: "{{ linsat_gateway_url }}"
|
||||
dest: /usr/local/bin/linstor-gateway
|
||||
checksum: sha256:{{ linsat_gateway_sha256 }}
|
||||
mode: 755
|
||||
when: lingw_install_mode != 'none'
|
||||
tags: drbd
|
||||
|
||||
- name: Install linstor-gateway service unit
|
||||
template: src=linstor-gateway.service.j2 dest=/etc/systemd/system/linstor-gateway.service
|
||||
notify: restart linstor-gateway
|
||||
register: lingw_unit
|
||||
tags: drbd
|
||||
|
||||
- name: Reload systemd
|
||||
systemd: daemon_reload=True
|
||||
when: lingw_unit.changed
|
||||
tags: drbd
|
||||
|
19
roles/linstor_gateway/tasks/iptables.yml
Normal file
19
roles/linstor_gateway/tasks/iptables.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
|
||||
- name: Handle NFS port
|
||||
iptables_raw:
|
||||
name: lingw_nfs_port
|
||||
state: "{{ (lingw_nfs_src_ip | length > 0) | ternary('present','absent') }}"
|
||||
rules: |
|
||||
-A INPUT -m state --state NEW -p tcp --dport 2049 -s {{ lingw_nfs_src_ip | join(',') }} -j ACCEPT
|
||||
-A INPUT -m state --state NEW -p tcp --dport 111 -s {{ lingw_nfs_src_ip | join(',') }} -j ACCEPT
|
||||
-A INPUT -m state --state NEW -p udp --dport 111 -s {{ lingw_nfs_src_ip | join(',') }} -j ACCEPT
|
||||
tags: firewall,drbd
|
||||
|
||||
- name: Handle iSCSI port
|
||||
iptables_raw:
|
||||
name: lingw_iscsi_port
|
||||
state: "{{ (lingw_iscsi_src_ip | length > 0) | ternary('present','absent') }}"
|
||||
rules: "-A INPUT -m state --state NEW -p tcp --dport 3260 -s {{ lingw_iscsi_src_ip | join(',') }} -j ACCEPT"
|
||||
tags: firewall,drbd
|
||||
|
23
roles/linstor_gateway/tasks/main.yml
Normal file
23
roles/linstor_gateway/tasks/main.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
|
||||
- include_tasks: directories.yml
|
||||
tags: always
|
||||
|
||||
- include_tasks: user.yml
|
||||
tags: drbd
|
||||
|
||||
- include_tasks: facts.yml
|
||||
tags: always
|
||||
|
||||
- include_tasks: install.yml
|
||||
tags: always
|
||||
|
||||
- include_tasks: conf.yml
|
||||
tags: always
|
||||
|
||||
- include_tasks: iptables.yml
|
||||
when: iptables_manage | default(True)
|
||||
tags: always
|
||||
|
||||
- include_tasks: services.yml
|
||||
tags: always
|
10
roles/linstor_gateway/tasks/services.yml
Normal file
10
roles/linstor_gateway/tasks/services.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
|
||||
- name: Ensure NFS server is disabled
|
||||
service: name=nfs-server enabled=False
|
||||
tags: drbd
|
||||
|
||||
- name: Start and enable linstor-gateway
|
||||
service: name=linstor-gateway state=started enabled=True
|
||||
register: lingw_started
|
||||
tags: drbd
|
8
roles/linstor_gateway/tasks/user.yml
Normal file
8
roles/linstor_gateway/tasks/user.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
|
||||
- name: Create linstor-gateway user
|
||||
user:
|
||||
name: linstor-gateway
|
||||
system: True
|
||||
shell: /sbin/nologin
|
||||
tags: drbd
|
Reference in New Issue
Block a user