Move tasks for all hosts to separate file
When working on !54 it became obvious playbooks could be structured better in this project. Therefor we move the tasks supposed to be run for _all_ hosts to a separate file. The *main.yml* file should only import other playbooks from now on, should not define tasks anymore.
This commit is contained in:
parent
9f3d91bd1c
commit
e29311c4ed
2 changed files with 41 additions and 34 deletions
38
all.yml
Normal file
38
all.yml
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
---
|
||||||
|
# tasks for all hosts
|
||||||
|
|
||||||
|
- hosts: all
|
||||||
|
become: true
|
||||||
|
|
||||||
|
vars:
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: ansible.timezone
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Update and clean package cache
|
||||||
|
apt:
|
||||||
|
update_cache: true
|
||||||
|
cache_valid_time: 3600
|
||||||
|
autoclean: true
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Ensure unattended-upgrades is installed and up to date
|
||||||
|
apt:
|
||||||
|
name: unattended-upgrades
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Setup unattended-upgrades
|
||||||
|
include_role:
|
||||||
|
name: ansible-role-unattended-upgrades
|
||||||
|
vars:
|
||||||
|
unattended_origins_patterns:
|
||||||
|
- "origin=Debian,archive=buster-security"
|
||||||
|
- "o=Debian,a=buster-updates"
|
||||||
|
unattended_package_blacklist: [cowsay]
|
||||||
|
unattended_mail: "root"
|
||||||
|
|
||||||
|
- name: Setup users
|
||||||
|
include_role:
|
||||||
|
name: users
|
37
main.yml
37
main.yml
|
@ -1,39 +1,8 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
# main playbook aggregating all the other playbooks
|
||||||
become: true
|
|
||||||
|
|
||||||
vars:
|
- name: Setup for all hosts
|
||||||
ansible_python_interpreter: /usr/bin/python3
|
import_playbook: all.yml
|
||||||
|
|
||||||
roles:
|
|
||||||
- role: ansible.timezone
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: Update and clean package cache
|
|
||||||
apt:
|
|
||||||
update_cache: true
|
|
||||||
cache_valid_time: 3600
|
|
||||||
autoclean: true
|
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Ensure unattended-upgrades is installed and up to date
|
|
||||||
apt:
|
|
||||||
name: unattended-upgrades
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Setup unattended-upgrades
|
|
||||||
include_role:
|
|
||||||
name: ansible-role-unattended-upgrades
|
|
||||||
vars:
|
|
||||||
unattended_origins_patterns:
|
|
||||||
- "origin=Debian,archive=buster-security"
|
|
||||||
- "o=Debian,a=buster-updates"
|
|
||||||
unattended_package_blacklist: [cowsay]
|
|
||||||
unattended_mail: "root"
|
|
||||||
|
|
||||||
- name: Setup users
|
|
||||||
include_role:
|
|
||||||
name: users
|
|
||||||
|
|
||||||
- name: Specific setup for all proxmox hosts
|
- name: Specific setup for all proxmox hosts
|
||||||
import_playbook: proxmox.yml
|
import_playbook: proxmox.yml
|
||||||
|
|
Loading…
Reference in a new issue