From 680b09ca2c6162b31e2378d3f67d05a5e651e39d Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Thu, 8 Apr 2021 00:39:41 +0200 Subject: [PATCH] Move playbooks in a separate directory Signed-off-by: Yohann D'ANELLO --- ansible.cfg | 4 +++- group_vars/debian.yml | 1 + plays/apt.yml | 7 +++++++ base.yml => plays/base.yml | 7 ++----- roles/apt/templates/apt/sources.list.j2 | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) create mode 100755 plays/apt.yml rename base.yml => plays/base.yml (73%) diff --git a/ansible.cfg b/ansible.cfg index 009196a..3bfbe11 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,7 +1,9 @@ [defaults] +# Explicitely redefined some defaults to make play execution work +roles_path = ./roles + inventory = ./hosts timeout = 60 -# ask_vault_pass = True [privilege_escalation] become = True diff --git a/group_vars/debian.yml b/group_vars/debian.yml index 3daeefd..fbbf164 100644 --- a/group_vars/debian.yml +++ b/group_vars/debian.yml @@ -1,6 +1,7 @@ --- glob_apt: mirror: "http://mirror.crans.org/" + backports: false extra_repositories: [] pin: bullseye: [] diff --git a/plays/apt.yml b/plays/apt.yml new file mode 100755 index 0000000..0c59641 --- /dev/null +++ b/plays/apt.yml @@ -0,0 +1,7 @@ +#!/usr/bin/env ansible-playbook +--- +- hosts: debian + vars: + apt: "{{ glob_apt | default({}) | combine(service_apt | default({})) | combine(loc_apt | default({})) }}" + roles: + - apt diff --git a/base.yml b/plays/base.yml similarity index 73% rename from base.yml rename to plays/base.yml index c78a0af..9bae46d 100755 --- a/base.yml +++ b/plays/base.yml @@ -1,10 +1,7 @@ #!/usr/bin/env ansible-playbook --- -- hosts: debian - vars: - apt: "{{ glob_apt | default({}) | combine(service_apt | default({})) | combine(loc_apt | default({})) }}" - roles: - - apt + +- import_playbook: apt.yml - hosts: all roles: diff --git a/roles/apt/templates/apt/sources.list.j2 b/roles/apt/templates/apt/sources.list.j2 index c07dc96..a9398c5 100644 --- a/roles/apt/templates/apt/sources.list.j2 +++ b/roles/apt/templates/apt/sources.list.j2 @@ -12,7 +12,7 @@ deb {{ apt.mirror }}debian {{ ansible_distribution_release }} main contrib n # Dépôt pour mises à jour fréquentes (volatile) deb {{ apt.mirror }}debian {{ ansible_distribution_release }}-updates main contrib non-free -{% if backports | default(false) %} +{% if apt.backports | default(false) %} # Backports deb {{ apt.mirror }}debian {{ ansible_distribution_release }}-backports main contrib non-free {% endif %}