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 name: consul
state: latest state: latest
update_cache: yes update_cache: yes
when: ansible_check_mode == false
- name: Add consul user - name: Add consul user
become: true become: true
@ -32,12 +33,16 @@
name: consul name: consul
enabled: yes enabled: yes
state: started state: started
when: ansible_check_mode == false
- name: Check if consul is running - name: Check if consul is running
become: true become: true
shell: consul members shell: consul members
register: consul_members register: consul_members
when: ansible_check_mode == false
- name: Print consul members - name: Print consul members
debug: debug:
msg: "{{ consul_members.stdout_lines }}" msg: "{{ consul_members.stdout_lines }}"
when: ansible_check_mode == false

View file

@ -5,6 +5,7 @@
name: nomad name: nomad
state: latest state: latest
update_cache: yes update_cache: yes
when: ansible_check_mode == false
- name: Add nomad user - name: Add nomad user
become: true become: true
@ -39,21 +40,26 @@
name: nomad name: nomad
enabled: yes enabled: yes
state: started state: started
when: ansible_check_mode == false
- name: Check nomad status - name: Check nomad status
become: true become: true
shell: nomad status shell: nomad status
register: nomad_status register: nomad_status
when: ansible_check_mode == false
- name: Print nomad status - name: Print nomad status
debug: debug:
msg: '{{ nomad_status.stdout }}' msg: '{{ nomad_status.stdout }}'
when: ansible_check_mode == false
- name: Check nomad members - name: Check nomad members
become: true become: true
shell: nomad members shell: nomad members
register: nomad_members register: nomad_members
when: ansible_check_mode == false
- name: Print nomad members - name: Print nomad members
debug: debug:
msg: '{{ nomad_members.stdout }}' msg: '{{ nomad_members.stdout }}'
when: ansible_check_mode == false