From b6c49df58c1d8d23f411327d93b189613e7f6242 Mon Sep 17 00:00:00 2001 From: James Hackett Date: Mon, 19 Dec 2022 20:45:26 +0000 Subject: [PATCH] adds check for ansible check_mode --- ansible/roles/configure-consul/tasks/main.yml | 5 +++++ ansible/roles/configure-nomad/tasks/main.yml | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ansible/roles/configure-consul/tasks/main.yml b/ansible/roles/configure-consul/tasks/main.yml index e20eaf3..dcda34c 100644 --- a/ansible/roles/configure-consul/tasks/main.yml +++ b/ansible/roles/configure-consul/tasks/main.yml @@ -5,6 +5,7 @@ name: consul state: latest update_cache: yes + when: ansible_check_mode == false - name: Add consul user become: true @@ -32,12 +33,16 @@ name: consul enabled: yes state: started + when: ansible_check_mode == false - name: Check if consul is running become: true shell: consul members register: consul_members + when: ansible_check_mode == false - name: Print consul members debug: msg: "{{ consul_members.stdout_lines }}" + when: ansible_check_mode == false + diff --git a/ansible/roles/configure-nomad/tasks/main.yml b/ansible/roles/configure-nomad/tasks/main.yml index 79e6980..a5f89f7 100644 --- a/ansible/roles/configure-nomad/tasks/main.yml +++ b/ansible/roles/configure-nomad/tasks/main.yml @@ -5,6 +5,7 @@ name: nomad state: latest update_cache: yes + when: ansible_check_mode == false - name: Add nomad user become: true @@ -39,21 +40,26 @@ name: nomad enabled: yes state: started + when: ansible_check_mode == false - name: Check nomad status become: true shell: nomad status register: nomad_status + when: ansible_check_mode == false - name: Print nomad status debug: msg: '{{ nomad_status.stdout }}' + when: ansible_check_mode == false - name: Check nomad members become: true shell: nomad members register: nomad_members + when: ansible_check_mode == false - name: Print nomad members debug: msg: '{{ nomad_members.stdout }}' + when: ansible_check_mode == false