feat: reworked most of the ansible playbooks and roles
This commit is contained in:
@@ -1,5 +1,36 @@
|
||||
---
|
||||
- name: "Configure SSH for Public Key Authentication."
|
||||
shell: |
|
||||
sudo sed -i 's/.*PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config
|
||||
sudo sed -i 's/.*PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
|
||||
# Tasks for unregistering from Red Hat Subscription Manager.
|
||||
- name: "Unregistering from Red Hat Subscription Manager."
|
||||
community.general.redhat_subscription:
|
||||
state: absent
|
||||
when: ansible_distribution == 'RedHat'
|
||||
|
||||
# Tasks for configuring SSH for public key authentication.
|
||||
- name: "Configuring SSH for Public Key Authentication."
|
||||
block:
|
||||
- ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^PermitRootLogin'
|
||||
line: 'PermitRootLogin no'
|
||||
- ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^PubkeyAuthentication'
|
||||
line: 'PubkeyAuthentication yes'
|
||||
|
||||
# Tasks for setting the hostname.
|
||||
- name: "Setting the hostname."
|
||||
ansible.builtin.hostname:
|
||||
name: "localhost"
|
||||
|
||||
# Tasks for disabling SELinux.
|
||||
- name: "Disabling SELinux."
|
||||
ansible.builtin.selinux:
|
||||
state: disabled
|
||||
policy: targeted
|
||||
|
||||
# Tasks for restarting the SSH daemon.
|
||||
- name: "Restarting the SSH daemon."
|
||||
ansible.builtin.systemd:
|
||||
name: sshd
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
Reference in New Issue
Block a user