Add draft ansible playbooks for RD
This commit is contained in:
19
ansible/roles/rd_os-linux-prep/tasks/apt_conf.yml
Normal file
19
ansible/roles/rd_os-linux-prep/tasks/apt_conf.yml
Normal 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")
|
15
ansible/roles/rd_os-linux-prep/tasks/main.yml
Normal file
15
ansible/roles/rd_os-linux-prep/tasks/main.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
#- name: Ping
|
||||
# import_tasks: ping.yml
|
||||
|
||||
- name:
|
||||
import_tasks: apt_conf.yml
|
||||
|
||||
- name:
|
||||
import_tasks: os_conf.yml
|
||||
|
||||
|
||||
|
||||
|
||||
|
39
ansible/roles/rd_os-linux-prep/tasks/os_conf.yml
Normal file
39
ansible/roles/rd_os-linux-prep/tasks/os_conf.yml
Normal 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"
|
12
ansible/roles/rd_os-linux-prep/tasks/ping.yml
Normal file
12
ansible/roles/rd_os-linux-prep/tasks/ping.yml
Normal 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"
|
||||
|
Reference in New Issue
Block a user