new major update
This commit is contained in:
60 files changed
+2228
-615
No files matched your search
+23
-64
@@ -14,6 +14,28 @@
|
||||
- vars/users@{{ inventory_hostname | default('vps') }}.yml
|
||||
- vars/config@{{ inventory_hostname | default('vps') }}.yml
|
||||
tasks:
|
||||
- name: Managing hostname
|
||||
block:
|
||||
- name: Updating hostname
|
||||
become: true
|
||||
ansible.builtin.hostname:
|
||||
name: "{{ fqdn | default(inventory_hostname) }}"
|
||||
- name: Updating hosts file
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: "^127\\.0\\.1\\.1"
|
||||
line: "127.0.1.1 {{ fqdn | default(inventory_hostname) }}"
|
||||
insertbefore: BOF
|
||||
state: present
|
||||
- name: Updating host icon name
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
cmd: "hostnamectl set-icon-name computer-server"
|
||||
- name: Rebooting machine for hostname change
|
||||
become: true
|
||||
ansible.builtin.reboot:
|
||||
msg: "Rebooting machine.."
|
||||
- name: Hardening SSH server
|
||||
ansible.builtin.include_role:
|
||||
name: init-server # required. The name of the role to be executed.
|
||||
@@ -33,67 +55,4 @@
|
||||
name: init-server
|
||||
tasks_from: ssh-users
|
||||
- name: Flushing handlers
|
||||
ansible.builtin.meta: flush_handlers
|
||||
- name: Updating hostname
|
||||
become: true
|
||||
ansible.builtin.hostname:
|
||||
name: "{{ fqdn | default(inventory_hostname) }}"
|
||||
- name: Updating hosts file
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: "^127\\.0\\.1\\.1"
|
||||
line: "127.0.1.1 {{ fqdn | default(inventory_hostname) }}"
|
||||
insertbefore: BOF
|
||||
state: present
|
||||
- name: Updating host icon name
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
cmd: "hostnamectl set-icon-name computer-server"
|
||||
- name: Opening port 51820
|
||||
become: true
|
||||
ansible.builtin.iptables:
|
||||
chain: INPUT
|
||||
protocol: "{{ item }}"
|
||||
destination_port: 51820
|
||||
jump: ACCEPT
|
||||
comment: Open up port 51820
|
||||
loop:
|
||||
- udp
|
||||
- tcp
|
||||
- name: Opening port 443
|
||||
become: true
|
||||
ansible.builtin.iptables:
|
||||
chain: INPUT
|
||||
protocol: "{{ item }}"
|
||||
destination_port: 443
|
||||
jump: ACCEPT
|
||||
comment: Open up port 443
|
||||
loop:
|
||||
- udp
|
||||
- tcp
|
||||
- name: Opening ports
|
||||
become: true
|
||||
ansible.builtin.iptables:
|
||||
chain: INPUT
|
||||
protocol: tcp
|
||||
destination_port: "{{ item }}"
|
||||
jump: ACCEPT
|
||||
comment: "Open up port {{ (item | string) }}"
|
||||
loop:
|
||||
- 80
|
||||
- 465
|
||||
- 587
|
||||
- 995
|
||||
- 993
|
||||
- name: Notifying user that all processes have finished
|
||||
ansible.builtin.debug:
|
||||
msg: All processes finished. Hit enter to reboot machine.
|
||||
- name: Ensuring user has read prior message regarding upcoming reboot
|
||||
ansible.builtin.pause:
|
||||
- name: Rebooting machine for hostname change
|
||||
become: true
|
||||
ansible.builtin.reboot:
|
||||
msg: "Rebooting machine.."
|
||||
connect_timeout: 0
|
||||
test_command: ~
|
||||
ansible.builtin.meta: flush_handlers
|
||||
Reference in new issue
Block a user