78 lines
1.9 KiB
YAML
78 lines
1.9 KiB
YAML
---
|
|
- name: Set a hostname
|
|
ansible.builtin.hostname:
|
|
name: "{{ hostname }}"
|
|
when: hostname is defined
|
|
|
|
- name: Set Prompt coloring
|
|
ansible.builtin.template:
|
|
src: prompt.sh.j2
|
|
dest: /etc/profile.d/prompt.sh
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
|
|
- name: Добавить строку в файл, если её нет
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/vconsole.conf
|
|
regexp: '^FONT\s*='
|
|
line: 'FONT="UniCyr_8x16"'
|
|
create: true
|
|
|
|
- name: Syctl tuning
|
|
ansible.builtin.include_tasks: sysctl_tuning.yml
|
|
when: sysctl_tune is true
|
|
|
|
|
|
############# DEPRICATED ###################
|
|
# - name: Setup NIC to eth0
|
|
# ansible.builtin.include_tasks:
|
|
# file: set_network_nic.yml
|
|
#
|
|
# - name: Setup NIC to eth0
|
|
# ansible.builtin.include_tasks:
|
|
# file: set_nic_names_eth.yml
|
|
############################################
|
|
|
|
- name: Install packages
|
|
ansible.builtin.include_tasks:
|
|
file: install_packages.yml
|
|
|
|
- name: Disable SELinux
|
|
ansible.builtin.include_tasks:
|
|
file: security_setup.yml
|
|
|
|
- name: Logrotate
|
|
ansible.builtin.include_tasks:
|
|
file: logrotate.yml
|
|
|
|
- name: Check if Cloud-Init present
|
|
ansible.builtin.stat:
|
|
path: /etc/cloud
|
|
register: cloudinit_status
|
|
|
|
- name: Disable cloud-init
|
|
ansible.builtin.file:
|
|
path: /etc/cloud/cloud-init.disabled
|
|
state: touch
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
when: cloudinit_status.stat.exists
|
|
|
|
- name: Migrate legacy network scripts to NetworkManager keyfiles
|
|
ansible.builtin.command:
|
|
cmd: nmcli connection migrate
|
|
become: true
|
|
register: migration_result
|
|
changed_when: "'successfully migrated' in migration_result.stdout"
|
|
|
|
- name: Reboot System
|
|
ansible.builtin.debug:
|
|
msg:
|
|
- "Going to reboot..."
|
|
- "System: {{ ansible_distribution }}"
|
|
- "Version: {{ ansible_distribution_version }}"
|
|
notify: "Reboot Server"
|
|
when: reboot_system is true
|