feat: full untested ansible setup
This commit is contained in:
30
roles/base/tasks/main.yml
Normal file
30
roles/base/tasks/main.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: Set server hostname
|
||||
ansible.builtin.hostname:
|
||||
name: "{{ inventory_hostname_short }}"
|
||||
|
||||
- name: Ensure hostname resolves in /etc/hosts
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: '^127\.0\.1\.1\s'
|
||||
line: "127.0.1.1 {{ inventory_hostname }} {{ inventory_hostname_short }}"
|
||||
state: present
|
||||
|
||||
- name: Set server timezone
|
||||
ansible.builtin.command:
|
||||
cmd: "timedatectl set-timezone {{ timezone }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Install base packages
|
||||
ansible.builtin.apt:
|
||||
name: "{{ base_packages_common }}"
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Ensure srv root exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ srv_root }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
Reference in New Issue
Block a user