feat: Setup hostname, timezone, and secure sshd
This commit is contained in:
parent
5d193970bc
commit
e05b253210
5
roles/config/handlers/main.yml
Normal file
5
roles/config/handlers/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
- name: Reload dropbear
|
||||
service:
|
||||
name: dropbear
|
||||
state: reloaded
|
||||
enabled: yes
|
2
roles/config/meta/main.yml
Normal file
2
roles/config/meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- role: gekmihesg.openwrt
|
41
roles/config/tasks/main.yml
Normal file
41
roles/config/tasks/main.yml
Normal file
@ -0,0 +1,41 @@
|
||||
- name: Setup hostname
|
||||
when: inventory_hostname is defined
|
||||
uci:
|
||||
command: set
|
||||
key: 'system.@system[0]'
|
||||
value:
|
||||
hostname: "{{ inventory_hostname }}"
|
||||
|
||||
- name: Setup timezone
|
||||
uci:
|
||||
command: set
|
||||
key: 'system.@system[0]'
|
||||
value:
|
||||
timezone: "{{ timezone | default(system[template | default('default')].timezone) }}"
|
||||
zonename: "{{ zonename | default(system[template | default('default')].zonename) }}"
|
||||
|
||||
- name: commit changes
|
||||
uci:
|
||||
command: commit
|
||||
key: system
|
||||
|
||||
- name: Update authorized keys
|
||||
lineinfile:
|
||||
path: /etc/dropbear/authorized_keys
|
||||
line: "{{ lookup('file', '/home/' + lookup('env', 'USER') + '/.ssh/id_ed25519.pub') }}"
|
||||
state: present
|
||||
create: yes
|
||||
|
||||
- name: Disable Root password authentication
|
||||
uci:
|
||||
command: set
|
||||
key: "dropbear.@dropbear[0]"
|
||||
value:
|
||||
RootPasswordAuth: "off"
|
||||
PasswordAuth: "off"
|
||||
notify: reload dropbear
|
||||
|
||||
- name: Commit changes
|
||||
uci:
|
||||
command: commit
|
||||
key: dropbear
|
5
roles/config/vars/main.yml
Normal file
5
roles/config/vars/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
system:
|
||||
|
||||
default: &default_system
|
||||
timezone: 'EST5EDT,M3.2.0,M11.1.0'
|
||||
zonename: 'America/New York'
|
Loading…
Reference in New Issue
Block a user