2026-04-17 13:14:32 +02:00
|
|
|
---
|
|
|
|
|
- name: Sync Configuration Files
|
2026-06-28 16:39:16 +02:00
|
|
|
hosts: rhel
|
2026-04-17 13:14:32 +02:00
|
|
|
become: yes
|
|
|
|
|
vars:
|
|
|
|
|
worker_limit: 1024 # Global variable used in the template
|
|
|
|
|
|
|
|
|
|
tasks:
|
2026-07-23 15:36:44 +02:00
|
|
|
- name: Root password
|
|
|
|
|
ansible.builtin.import_tasks: tasks/rootpass.yml
|
|
|
|
|
|
|
|
|
|
- name: Create Directories
|
|
|
|
|
file:
|
|
|
|
|
path: '{{ item.directory }}'
|
|
|
|
|
state: directory
|
|
|
|
|
mode: "{{ item.mode | default('0755') }}"
|
2026-04-17 13:14:32 +02:00
|
|
|
owner: root
|
|
|
|
|
group: root
|
2026-07-23 15:36:44 +02:00
|
|
|
loop:
|
|
|
|
|
- { directory: "/var/backups" }
|
|
|
|
|
- { directory: "/opt/atclab/bin" }
|
|
|
|
|
- { directory: "/var/user", mode: "1777" }
|
|
|
|
|
|
|
|
|
|
- name: Copy etc configs
|
|
|
|
|
copy:
|
|
|
|
|
src: '{{ item.src }}'
|
|
|
|
|
dest: '{{ item.dest }}'
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
|
|
|
loop:
|
|
|
|
|
- { src: templates/users.autofs, dest: /etc/auto.master.d/users.autofs }
|
|
|
|
|
- { src: templates/auto.users, dest: /etc/auto.users }
|
|
|
|
|
- { src: templates/sssd.conf, dest: /etc/sssd/conf.d/sssd.conf, mode: '0600' }
|
|
|
|
|
|
|
|
|
|
# - name: Deploy sssd.conf
|
|
|
|
|
# template:
|
|
|
|
|
# src: templates/sssd.conf
|
|
|
|
|
# dest: /etc/sssd/conf.d/sssd.conf
|
|
|
|
|
# owner: root
|
|
|
|
|
# group: root
|
|
|
|
|
# mode: '0600'
|
|
|
|
|
# notify: Restart sssd # This triggers the handler only if the file changes
|
2026-04-17 13:14:32 +02:00
|
|
|
|
|
|
|
|
- name: Deploy ldap.conf
|
|
|
|
|
template:
|
|
|
|
|
src: templates/ldap.conf
|
|
|
|
|
dest: /etc/openldap/ldap.conf
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0644'
|
|
|
|
|
|
|
|
|
|
- name: Deploy sshd.conf
|
|
|
|
|
template:
|
|
|
|
|
src: templates/sshd.conf
|
|
|
|
|
dest: /etc/ssh/sshd_config.d/60_lab.conf
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0600'
|
|
|
|
|
|
|
|
|
|
- name: Deploy ssh.conf
|
|
|
|
|
template:
|
|
|
|
|
src: templates/ssh.conf
|
|
|
|
|
dest: /etc/ssh/ssh_config.d/60_lab.conf
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0644'
|
|
|
|
|
|
|
|
|
|
- name: Deploy sudoers
|
|
|
|
|
template:
|
|
|
|
|
src: templates/lab-sudo
|
|
|
|
|
dest: /etc/sudoers.d/sudogroup
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
2026-07-10 16:45:41 +02:00
|
|
|
mode: '0440'
|
2026-07-08 13:01:00 +02:00
|
|
|
|
|
|
|
|
- name: Deploy gitconfig
|
|
|
|
|
template:
|
|
|
|
|
src: templates/gitconfig
|
|
|
|
|
dest: /etc/gitconfig
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0644'
|
2026-04-17 13:14:32 +02:00
|
|
|
|
2026-07-23 15:36:44 +02:00
|
|
|
- name: Copy profile configs
|
|
|
|
|
copy:
|
|
|
|
|
src: etc/profile.d/
|
|
|
|
|
dest: /etc/profile.d/
|
2026-04-20 10:00:31 +02:00
|
|
|
owner: root
|
|
|
|
|
group: root
|
2026-07-23 15:36:44 +02:00
|
|
|
mode: '0644'
|
2026-04-20 10:00:31 +02:00
|
|
|
|
|
|
|
|
- name: Copy etc configs
|
|
|
|
|
copy:
|
2026-07-23 15:36:44 +02:00
|
|
|
src: '{{ item.src }}'
|
|
|
|
|
dest: '{{ item.dest }}'
|
2026-04-20 10:00:31 +02:00
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0644'
|
2026-07-23 15:36:44 +02:00
|
|
|
loop:
|
|
|
|
|
- { src: templates/users.autofs, dest: /etc/auto.master.d/users.autofs }
|
|
|
|
|
- { src: templates/auto.users, dest: /etc/auto.users }
|
2026-04-20 10:00:31 +02:00
|
|
|
|
|
|
|
|
- name: Copy bin scripts
|
|
|
|
|
copy:
|
|
|
|
|
src: bin/
|
|
|
|
|
dest: /opt/atclab/bin
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: '0755'
|
|
|
|
|
|
2026-06-23 13:48:34 +02:00
|
|
|
- name: Enable AutoFS
|
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
|
name: autofs
|
|
|
|
|
state: started
|
2026-06-28 12:52:04 +02:00
|
|
|
enabled: yes
|
2026-06-23 13:48:34 +02:00
|
|
|
|
2026-04-17 13:14:32 +02:00
|
|
|
handlers:
|
|
|
|
|
- name: Restart sssd
|
|
|
|
|
service:
|
|
|
|
|
name: sssd
|
|
|
|
|
state: restarted
|
2026-06-23 13:48:34 +02:00
|
|
|
|