--- - name: Install or update nomad become: true apt: name: nomad state: latest update_cache: yes when: ansible_check_mode == false - name: Add nomad user become: true user: name: nomad shell: /bin/false system: yes - name: Create nomad group become: true group: name: nomad system: yes - name: Create nomad directories become: true file: path: '{{ item }}' state: directory owner: nomad group: nomad mode: 0750 with_items: - /etc/nomad.d - /opt/nomad - include_tasks: configure.yml - name: Enable and start nomad become: true systemd: 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 server members register: nomad_members when: ansible_check_mode == false - name: Print nomad members debug: msg: '{{ nomad_members.stdout }}' when: ansible_check_mode == false