1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00
iiab/roles/1-prep/tasks/uuid.yml

27 lines
688 B
YAML
Raw Normal View History

2021-07-31 20:43:29 +00:00
- name: "Install packages: uuid-runtime"
package:
name: uuid-runtime
state: present
- name: Does /etc/iiab/uuid exist?
stat:
path: /etc/iiab/uuid
register: uuid_file
- name: If not, run 'uuidgen' to create a uuid, in register uuid_response
command: uuidgen
register: uuid_response
when: not uuid_file.stat.exists
- name: Save it to /etc/iiab/uuid
shell: echo {{ uuid_response.stdout_lines[0] }} > /etc/iiab/uuid
when: not uuid_file.stat.exists
- name: Load /etc/iiab/uuid, into register stored_uuid
command: cat /etc/iiab/uuid
register: stored_uuid
- name: Store it in Ansible variable 'uuid'
set_fact:
uuid: "{{ stored_uuid.stdout_lines[0] }}"