From e3ed5675a91872d76471ff6181720de46b7902da Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 18 Jun 2019 10:47:40 -0400 Subject: [PATCH] Consistent newhost format between roles --- roles/base/tasks/main.yml | 24 ++++++++++++++++-------- roles/pvc/tasks/main.yml | 4 ++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 6fda34b..c32f054 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -2,11 +2,19 @@ # # First run check # -- name: first run check - shell: "echo 'bootstrapped' > /etc/pvc-base-install" - register: newhost +- name: check if this is a new instance + shell: "echo 'bootstrapped' > /etc/pvc-install.base" args: - creates: "/etc/pvc-base-install" + creates: /etc/pvc-install.base + register: newhost_check + tags: always + +- name: set newhost fact + set_fact: + newhost: yes + when: newhost_check.changed + tags: always + # # Install custom fact scripts @@ -73,27 +81,27 @@ - name: apt update apt: update-cache: yes - when: newhost.changed + when: newhost is defined and newhost - name: aptitude safe upgrade with autoremove apt: update_cache: yes autoremove: yes upgrade: safe - when: newhost.changed + when: newhost is defined and newhost - name: install dbus apt: name: - dbus state: latest - when: newhost.changed + when: newhost is defined and newhost - name: clean out apt cache file: path: "/var/cache/apt/archives" state: absent - when: newhost.changed + when: newhost is defined and newhost # # Purge unneeded packages diff --git a/roles/pvc/tasks/main.yml b/roles/pvc/tasks/main.yml index fedc614..2dbad46 100644 --- a/roles/pvc/tasks/main.yml +++ b/roles/pvc/tasks/main.yml @@ -2,9 +2,9 @@ # First-run check - name: check if this is a new instance - shell: "echo 'bootstrapped' > /etc/pvc-pvc-install" + shell: "echo 'bootstrapped' > /etc/pvc-install.pvc" args: - creates: /etc/pvc-pvc-install + creates: /etc/pvc-install.pvc register: newhost_check tags: always