Import OS-specific vars from task in common role

We stopped being able to do dynamic includes from the playbooks around
Ansible 2.4.0.0 if I recall correctly. Instead we can create a task to
include the variables and make it always run by using the special tag.

For now the Debian and Ubuntu vars files are the same, but I will keep
them separate so that it is more flexible in the future.
This commit is contained in:
Alan Orth 2018-04-25 18:00:56 +03:00
parent f3403cc79a
commit a7eb04a152
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
3 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,7 @@
---
- name: Import OS-specific variables
include_vars: "vars/{{ ansible_distribution }}.yml"
tags: always
- name: Configure network time
import_tasks: ntp.yml

10
vars/Ubuntu.yml Normal file
View File

@ -0,0 +1,10 @@
---
# sshd service name is `ssh` on Debian/Ubuntu, but it's
# `sshd` on CentOS
sshd_service_name: ssh
# provisioning user vars
provisioning_user: { name: 'provisioning', home: '/home/provisioning' }
# vim: set ts=2 sw=2:

View File

@ -13,6 +13,5 @@
- munin
vars_files:
- vars/ipsets.yml
- vars/Debian.yml
# vim: set sw=2 ts=2: