101 lines
2.0 KiB
YAML
101 lines
2.0 KiB
YAML
|
---
|
||
|
- import_tasks: ssh.yml
|
||
|
tags:
|
||
|
- ssh
|
||
|
|
||
|
- name: fix hostname
|
||
|
template:
|
||
|
src: hostname.j2
|
||
|
dest: /etc/hostname
|
||
|
register: firsttime
|
||
|
notify:
|
||
|
- reload hostname
|
||
|
# tags:
|
||
|
# - always
|
||
|
|
||
|
- name: fix /etc/hosts
|
||
|
lineinfile:
|
||
|
dest: /etc/hosts
|
||
|
regexp: "^{{ item.ip }}"
|
||
|
line: "{{ item.ip }} {{ item.hosts }}"
|
||
|
with_items:
|
||
|
- ip: "127.0.0.1"
|
||
|
hosts: "{{ inventory_hostname }}.{{ mydomain }} {{ inventory_hostname }} localhost localhost.localdomain"
|
||
|
- ip: "::1"
|
||
|
hosts: "{{ inventory_hostname }}.{{ mydomain }} {{ inventory_hostname }} localhost localhost.localdomain"
|
||
|
when: mydomain is defined
|
||
|
|
||
|
- import_tasks: "pkg_Alpine.yml"
|
||
|
when: ansible_distribution == 'Alpine'
|
||
|
tags:
|
||
|
- pkg
|
||
|
- import_tasks: "pkg_Debian.yml"
|
||
|
when: ansible_distribution == 'Debian'
|
||
|
tags:
|
||
|
- pkg
|
||
|
|
||
|
- name: ensure rngd is running
|
||
|
service:
|
||
|
name: rngd
|
||
|
enabled: yes
|
||
|
state: started
|
||
|
tags:
|
||
|
- pkg
|
||
|
|
||
|
- include_tasks: "sshd.yml"
|
||
|
tags:
|
||
|
- ssh
|
||
|
|
||
|
- name: ensure netmount is enabled
|
||
|
service:
|
||
|
name: netmount
|
||
|
enabled: yes
|
||
|
state: started
|
||
|
tags:
|
||
|
- pkg
|
||
|
when: ansible_distribution == 'Alpine' and iscsid.session[ansible_hostname] is defined
|
||
|
|
||
|
- name: ensure haveged is disabled
|
||
|
service:
|
||
|
name: haveged
|
||
|
enabled: no
|
||
|
state: stopped
|
||
|
tags:
|
||
|
- pkg
|
||
|
|
||
|
- name: configure networking
|
||
|
template:
|
||
|
src: networking.j2
|
||
|
dest: /etc/network/interfaces
|
||
|
when: wanted_ip4 is defined or wanted_ip6 is defined
|
||
|
tags:
|
||
|
- networking
|
||
|
|
||
|
- name: configure watchdog
|
||
|
template:
|
||
|
src: watchdog.conf.j2
|
||
|
dest: /etc/conf.d/watchdog
|
||
|
when: ansible_distribution == 'Alpine'
|
||
|
|
||
|
- name: configure watchdog
|
||
|
template:
|
||
|
src: watchdog-deb.conf.j2
|
||
|
dest: /etc/watchdog.conf
|
||
|
when: ansible_distribution != 'Alpine'
|
||
|
|
||
|
- name: ensure watchdog is running
|
||
|
service:
|
||
|
name: watchdog
|
||
|
enabled: yes
|
||
|
state: started
|
||
|
|
||
|
- name: configure chrony
|
||
|
template:
|
||
|
src: chrony.conf.j2
|
||
|
dest: /etc/chrony/chrony.conf
|
||
|
notify:
|
||
|
- reload chronyd
|
||
|
when: ansible_distribution == 'Alpine'
|
||
|
tags:
|
||
|
- chrony
|