Consistent newhost format between roles

This commit is contained in:
Joshua Boniface 2023-09-01 15:42:20 -04:00
parent f1cca0e22f
commit aef72555c1
2 changed files with 18 additions and 10 deletions

View File

@ -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

View File

@ -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