Add draft ansible playbooks for RD

This commit is contained in:
2024-12-28 20:01:08 +03:00
parent fdd09e4774
commit 8dbf6cbfd9
18 changed files with 130 additions and 15 deletions

View File

@ -0,0 +1,19 @@
---
- name: Configure apt for using local REPO
block:
- name: Copy sources.list with local REPO
ansible.builtin.copy:
src: files/debian12/sources.list
dest: /etc/apt/sources.list
owner: root
group: root
mode: '0644'
- name: Run "apt-get clean"
ansible.builtin.apt:
clean: yes
- name: Run "apt update" and NOT "apt upgrade"
ansible.builtin.apt:
upgrade: no
update_cache: yes
when: (ansible_os_family == "Debian" and ansible_distribution_major_version == "12")

View File

@ -0,0 +1,15 @@
---
#- name: Ping
# import_tasks: ping.yml
- name:
import_tasks: apt_conf.yml
- name:
import_tasks: os_conf.yml

View File

@ -0,0 +1,39 @@
---
- include_vars: vars/os-creds.yml
- name: OS configure
block:
- name: Add SSH keys for root
authorized_key:
user: "{{ item.username }}"
state: present
# exclusive: true
key: "{{ item.ssh_key }}"
loop: "{{ os_user_root_sshkeys }}"
no_log: true
- name: Set root password = '*'
ansible.builtin.user:
name: root
password: '*'
when: (ansible_os_family == "Debian" and ansible_distribution_major_version == "12")
- name: OS configure
block:
- name: Change DNS setting /etc/resolv.conf INSIDE
ansible.builtin.copy:
src: files/debian12/resolv_inside.conf
dest: /etc/resolv.conf
owner: root
group: root
mode: '0644'
when: (ansible_os_family == "Debian" and ansible_distribution_major_version == "12") and ansible_default_ipv4.broadcast.split('.')[1] != "11"
- name: OS configure
block:
- name: Change DNS setting /etc/resolv.conf DMZ
ansible.builtin.copy:
src: files/debian12/resolv_dmz.conf
dest: /etc/resolv.conf
owner: root
group: root
mode: '0644'
when: (ansible_os_family == "Debian" and ansible_distribution_major_version == "12") and ansible_default_ipv4.broadcast.split('.')[1] == "11"

View File

@ -0,0 +1,12 @@
---
#- name: ping
# ping:
- name: OS configure
block:
- name: ping
debug:
msg: "{{ ansible_default_ipv4.broadcast.split('.')[1] }}"
when: (ansible_os_family == "Debian" and ansible_distribution_major_version == "12") and ansible_default_ipv4.broadcast.split('.')[1] != "11"