2021-02-03 07:36:51 -06:00
|
|
|
---
|
|
|
|
# Enable and disable services.
|
|
|
|
|
2021-02-15 09:39:39 -06:00
|
|
|
## SSHFS ##
|
2021-02-15 09:22:26 -06:00
|
|
|
|
2021-02-15 09:39:39 -06:00
|
|
|
- name: General | Software | Services | Enable SSHD (Linux?)
|
|
|
|
service:
|
|
|
|
name: fusefs
|
|
|
|
pattern: fusefs
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
2021-02-03 07:36:51 -06:00
|
|
|
when: ansible_system == "FreeBSD"
|
|
|
|
|
2021-02-15 09:22:26 -06:00
|
|
|
|
|
|
|
## CUPS ##
|
|
|
|
|
2021-02-03 07:36:51 -06:00
|
|
|
- name: General | Software | Services | Disable CUPS Daemon
|
|
|
|
service:
|
|
|
|
name: "{{ cups }}"
|
|
|
|
pattern: "{{ cups_pattern }}"
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
|
|
|
- name: General | Software | Services | Disable CUPS-Browse Daemon
|
|
|
|
service:
|
|
|
|
name: "{{ cups_browse }}"
|
|
|
|
pattern: "{{ cups_browse_pattern }}"
|
|
|
|
state: stopped
|
2021-02-15 08:40:32 -06:00
|
|
|
enabled: no
|
|
|
|
|
2021-02-15 09:22:26 -06:00
|
|
|
|
|
|
|
## SSHD ##
|
2021-02-15 08:40:32 -06:00
|
|
|
|
2021-02-15 10:34:06 -06:00
|
|
|
- name: General | Software | Services | Configure SSHD
|
2021-02-15 09:22:26 -06:00
|
|
|
lineinfile:
|
|
|
|
path: "{{ sshd_config }}"
|
|
|
|
regexp: '{{ item.key }}'
|
|
|
|
line: '{{ item.value }} # MANAGED BY ANSIBLE'
|
|
|
|
state: present
|
|
|
|
create: no
|
|
|
|
backup: yes
|
|
|
|
loop:
|
|
|
|
- { "key": '^[\#]?AllowTcpForwarding', "value": 'AllowTcpForwarding no'}
|
|
|
|
- { "key": '^[\#]?ClientAliveCountMax', "value": 'ClientAliveCountMax 2'}
|
|
|
|
- { "key": '^[\#]?Compression', "value": 'Compression no'}
|
|
|
|
- { "key": '^[\#]?LogLevel', "value": 'LogLevel verbose'}
|
|
|
|
- { "key": '^[\#]?MaxAuthTries', "value": 'MaxAuthTries 3'}
|
|
|
|
- { "key": '^[\#]?MaxSessions', "value": 'MaxSessions 2'}
|
|
|
|
#- { "key": '^[\#]?Port', "value": 'Port '}
|
|
|
|
- { "key": '^[\#]?TCPKeepAlive', "value": 'TCPKeepAlive no'}
|
|
|
|
- { "key": '^[\#]?X11Forwarding', "value": 'X11Forwarding no'}
|
|
|
|
- { "key": '^[\#]?AllowAgentForwarding', "value": 'AllowAgentForwarding no'}
|
|
|
|
|
2021-02-20 10:03:04 -06:00
|
|
|
- name: General | Software | Services | Configure SSHD
|
|
|
|
lineinfile:
|
|
|
|
path: "{{ sshd_config }}"
|
|
|
|
regexp: '{{ item.key }}'
|
|
|
|
line: '{{ item.value }} # MANAGED BY ANSIBLE'
|
|
|
|
state: present
|
|
|
|
create: no
|
|
|
|
backup: yes
|
|
|
|
loop:
|
|
|
|
- { "key": '^[\#]?PermitRootLogin', "value": 'PermitRootLogin no'}
|
|
|
|
when: {{ not(ansible_kernel | select ("pve")) }}
|
|
|
|
|
2021-02-15 10:34:06 -06:00
|
|
|
- name: General | Software | Services | Enable SSHD
|
2021-02-15 09:22:26 -06:00
|
|
|
service:
|
|
|
|
name: "{{ sshd }}"
|
|
|
|
pattern: "{{ sshd_pattern }}"
|
2021-02-15 09:39:39 -06:00
|
|
|
state: reloaded
|
2021-02-15 09:22:26 -06:00
|
|
|
enabled: yes
|