From 1e9e359a33450176bbba5bf9f827b8e818c2065a Mon Sep 17 00:00:00 2001 From: Martin van Es <martin@mrvanes.com> Date: Wed, 30 Mar 2022 16:47:35 +0200 Subject: [PATCH] WIP --- roles/geodns/templates/geodns-update.service.j2 | 2 +- roles/local/tasks/main.yml | 5 +++++ inventory/local => roles/local/templates/local.j2 | 7 ++++--- roles/mdproxy/templates/mdproxy-update.service.j2 | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) rename inventory/local => roles/local/templates/local.j2 (69%) diff --git a/roles/geodns/templates/geodns-update.service.j2 b/roles/geodns/templates/geodns-update.service.j2 index b548274..276c923 100644 --- a/roles/geodns/templates/geodns-update.service.j2 +++ b/roles/geodns/templates/geodns-update.service.j2 @@ -5,7 +5,7 @@ Description=GeoDNS update Type=oneshot WorkingDirectory={{ mdxsaas_dir }} ExecStart=git pull -ExecStart=ansible-playbook playbook.yml -i inventory/local --tags local,geodns --limit local +ExecStart=ansible-playbook playbook.yml -i inventory/local --tags local,geodns --limit {{ inventory_hostname }} ExecStartPost=/bin/systemctl restart geodns [Install] diff --git a/roles/local/tasks/main.yml b/roles/local/tasks/main.yml index 7beb6ec..09096d6 100644 --- a/roles/local/tasks/main.yml +++ b/roles/local/tasks/main.yml @@ -12,6 +12,11 @@ version: "{{ mdxsaas_version }}" register: mdxsaas_git +- name: Create local inventory + ansible.builtin.template: + src: "local.j2" + dest: "{{ mdxsaas_dir }}/inventory/local" + - name: Write MDX-SAAS repo version shell: cmd: "git rev-parse HEAD > /tmp/mdx-saas-revision" diff --git a/inventory/local b/roles/local/templates/local.j2 similarity index 69% rename from inventory/local rename to roles/local/templates/local.j2 index d33c048..d89d6a9 100644 --- a/inventory/local +++ b/roles/local/templates/local.j2 @@ -1,19 +1,20 @@ # Inventory Aliases -local ansible_connection=local +{{ inventory_hostname }} ansible_connection=local # Hosts that receive the mdsigner role [mdsigner] # Hosts that receive the mdproxy role [mdproxy] -local +{{ inventory_hostname }} # Hosts that receive the GeoDNS role [geodns] -local +{{ inventory_hostname }} # All hosts for base role [all:children] mdsigner mdproxy geodns + diff --git a/roles/mdproxy/templates/mdproxy-update.service.j2 b/roles/mdproxy/templates/mdproxy-update.service.j2 index bcdce65..772ddf6 100644 --- a/roles/mdproxy/templates/mdproxy-update.service.j2 +++ b/roles/mdproxy/templates/mdproxy-update.service.j2 @@ -5,7 +5,7 @@ Description=mdproxy update Type=oneshot WorkingDirectory={{ mdxsaas_dir }} ExecStart=git pull -ExecStart=ansible-playbook playbook.yml -i inventory/local --tags local,mdproxy --limit local +ExecStart=ansible-playbook playbook.yml -i inventory/local --tags local,mdproxy --limit {{ inventory_hostname }} ExecStartPost=/bin/systemctl restart mdproxy [Install] -- GitLab