1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

1-prep/tasks/main.yml: Cleaner

This commit is contained in:
A Holt 2021-07-28 22:39:32 -04:00 committed by GitHub
parent c4989a03ec
commit b911429949
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,33 +8,32 @@
#when: dnsmasq_install # Flag might be used in future? #when: dnsmasq_install # Flag might be used in future?
- name: Install uuid-runtime package (debuntu) - name: 'Install packages: sudo, uuid-runtime'
package: package:
name: name:
- uuid-runtime
- sudo - sudo
- uuid-runtime
state: present state: present
when: is_debuntu
- name: Does /etc/iiab/uuid file exist? - name: Does /etc/iiab/uuid file exist?
stat: stat:
path: /etc/iiab/uuid path: /etc/iiab/uuid
register: uuid_file register: uuid_file
- name: If no uuid exists, create one - name: If not, run 'uuidgen' to create a uuid, in register uuid_response
shell: uuidgen command: uuidgen
register: uuid_response register: uuid_response
when: not uuid_file.stat.exists when: not uuid_file.stat.exists
- name: Put uuid in place at /etc/iiab/uuid - name: Save it to /etc/iiab/uuid
shell: echo {{ uuid_response.stdout_lines[0] }} > /etc/iiab/uuid shell: echo {{ uuid_response.stdout_lines[0] }} > /etc/iiab/uuid
when: not uuid_file.stat.exists when: not uuid_file.stat.exists
- name: Grab the uuid from /etc/iiab/uuid, into register stored_uuid - name: Load /etc/iiab/uuid, into register stored_uuid
command: cat /etc/iiab/uuid command: cat /etc/iiab/uuid
register: stored_uuid register: stored_uuid
- name: Place the uuid from register into variable/fact "uuid" - name: Store it in Ansible variable 'uuid'
set_fact: set_fact:
uuid: "{{ stored_uuid.stdout_lines[0] }}" uuid: "{{ stored_uuid.stdout_lines[0] }}"