blse2-public/common-debian/tasks/main.yml

118 lines
3.0 KiB
YAML

---
# First-run check
# Determines if the system has been bootstrapped previously
- name: ensure moe directory exists
file:
dest: /etc/moe
state: directory
tags: always
- name: first run bootstrap check
shell: "date > /etc/moe/bootstrapped"
register: bootstrap_check
args:
creates: "/etc/moe/bootstrapped"
tags: always
- set_fact:
bootstrap: no
tags: always
- set_fact:
bootstrap: yes
when: bootstrap_check.changed
tags: always
# Set system hostname
# Ensures that the system hostname matches the inventory hostname
- name: set hostname to inventory_hostname
copy:
dest: /etc/hostname
content: "{{ inventory_hostname }}\n"
tags: always
# Custom facts
# Loads facts.yml which installs and regathers supplemental local facts
- include: facts.yml
tags: debian-facts
# Configure APT environment
# Loads apt-base.yml which configures base Debian repositories
- include: apt-base.yml
tags: debian-apt-base
# Bootstrap APT configuration
# Loads apt-bootstrap.yml when bootstrap=yes to ensure system is ready for bootstrap
- include: apt-bootstrap.yml
when: bootstrap
tags: debian-apt-bootstrap
# Bootstrap restart (pre-configure)
# Loads restart.yml when bootstrap=yes to ensure system is ready for bootstrap
- include: restart.yml
when: bootstrap
tags: always
# Package configuration
# Loads apt-packages.yml to install and remove packages for base system setup
- include: apt-packages.yml
tags: debian-apt-packages
# General system setup
# Loads system.yml to configure core system items like capabilities, locales, timezones, cron, ntp, etc.
- include: system.yml
tags: debian-system
# Networking setup
# Loads network.yml to configure core network items like resolv.conf, hosts, firewall, etc.
- include: network.yml
tags: debian-network
# Syslog setup
# Loads syslog.yml to configure rsyslog
- include: syslog.yml
tags: debian-syslog
# Shell setup
# Loads shell.yml to configure basic global shell items like sudo, bash, motd, etc.
- include: shell.yml
tags: debian-shell
# SSH setup
# Loads ssh.yml to configure SSH server for remote management
- include: ssh.yml
tags: debian-ssh
# Monitoring setup
# Loads monitoring.yml to configure remote monitoring items like check_mk, etc.
- include: monitoring.yml
tags: debian-monitoring
# Root user setup
# Loads root.yml to configure root user
- include: users/root.yml
tags: debian-users-root
# Backup user setup
# Loads backup.yml to configure backup user
- include: users/backup.yml
tags: debian-users-backup
# Deploy (Ansible) user setup
# Loads deploy.yml to configure deploy user
- include: users/deploy.yml
tags: debian-users-deploy
# Administrative users setup
# Loads admin.yml to configure administrative shell users
- include: users/admin.yml
loop: "{{ admin_users }}"
tags: debian-users-admin
# Bootstrap restart (post-configure)
# Loads restart.yml when bootstrap=yes to ensure system is finalized after bootstrap
- include: restart.yml
when: bootstrap
tags: always