Skip to content

Commit

Permalink
Use ansible_env.HOME in customize_home role
Browse files Browse the repository at this point in the history
This was only working when run under the vagrant user
  • Loading branch information
wbclark committed Feb 9, 2024
1 parent 53105c5 commit 46b916a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions roles/customize_home/tasks/fix_env.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
- name: Check that the .env exists
stat:
path: /home/vagrant/foreman/.env
path: "{{ ansible_env.HOME }}/foreman/.env"
register: stat_result

- name: Ensure .env file contains current hostname
ansible.builtin.replace:
path: /home/vagrant/foreman/.env
path: "{{ ansible_env.HOME }}/foreman/.env"
regexp: '(.*)--public [a-zA-Z0-9-\.]*(.*)'
replace: '\1--public {{ ansible_fqdn }}\2'
when: stat_result
3 changes: 3 additions & 0 deletions roles/customize_home/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
when: customize_home_git_repo is defined

- include_tasks: fix_env.yml
args:
apply:
become: false

- name: Check custom bootstrap script exists
stat:
Expand Down

0 comments on commit 46b916a

Please sign in to comment.