adds check for ansible check_mode

This commit is contained in:
James Hackett 2022-12-19 20:45:26 +00:00
parent 77570effb5
commit b6c49df58c
2 changed files with 11 additions and 0 deletions

View file

@ -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

View file

@ -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