aboutsummaryrefslogtreecommitdiffstats
path: root/roles/common/tasks
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2022-01-10 16:43:35 +0000
committerGravatar GitHub <[email protected]>2022-01-10 16:43:35 +0000
commit913675699e867f1249d747c8e2275edc35462b39 (patch)
treedd2c3b1315933897756671c0610acfc310b5f112 /roles/common/tasks
parentAdd Ansible inventory (diff)
parentAdd common role for configuring hostnames and SSH (diff)
Merge pull request #1 from python-discord/jb3/common-role
Diffstat (limited to 'roles/common/tasks')
-rw-r--r--roles/common/tasks/main.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml
new file mode 100644
index 0000000..a83bac5
--- /dev/null
+++ b/roles/common/tasks/main.yml
@@ -0,0 +1,29 @@
+- name: Update hostname to match Ansible inventory
+ hostname:
+ name: "{{ inventory_hostname }}"
+
+- name: Update /etc/hosts to match Ansible inventory
+ template:
+ src: etc-hosts.j2
+ dest: /etc/hosts
+ mode: '0644'
+ owner: root
+ group: root
+
+- name: Disable SSH password authentication
+ lineinfile:
+ dest: /etc/ssh/sshd_config
+ regexp: "^PasswordAuthentication"
+ line: "PasswordAuthentication no"
+ state: present
+ notify:
+ - restart ssh
+
+- name: Set timezone to UTC
+ file:
+ src: /usr/share/zoneinfo/Etc/UTC
+ dest: /etc/localtime
+ mode: '0644'
+ owner: root
+ group: root
+ notify: restart systemd-timesyncd