-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
I'm using set_fact in a couple of places, e.g. below to get the 'real' hostname to send collectd data to grafana for the host with its real name.
That works pretty well - until I rerun ansible-bender in which case he ignores the sets and uses a cached image, I assume.
I can rerun ansible-bender with --no-cache and it starts working again, however I'm feeling that I do something wrong, maybe?
Playbook extract
- name: Get real hostname for conf file
local_action: ansible.builtin.command cat /etc/hostname
register: tmp
- name: Store hostname as "desiredhostname"
set_fact:
desiredhostname: "{{ tmp.stdout }}"
- name: debug
debug:
var: desiredhostname
Initial run - works fine
# ansible-bender build playbook.yml
PLAY [collectd - host overview to influxdb] ****************************************************************************************************************************************************************************************************************
TASK [Get real hostname for conf file] *********************************************************************************************************************************************************************************************************************
changed: [collectd-host-overview-influxdb-20210522-180419306640-cont]
TASK [Store hostname as "desiredhostname"] *****************************************************************************************************************************************************************************************************************
ok: [collectd-host-overview-influxdb-20210522-180419306640-cont]
TASK [debug] ***********************************************************************************************************************************************************************************************************************************************
ok: [collectd-host-overview-influxdb-20210522-180419306640-cont] => {
"desiredhostname": "my-podman-host-01"
}
[..]
next run - fails
# ansible-bender build playbook.yml
PLAY [collectd - host overview to influxdb] ****************************************************************************************************************************************************************************************************************
TASK [Get real hostname for conf file] *********************************************************************************************************************************************************************************************************************
loaded from cache: 'sha256:5dfbb8d9d4a86479e37e409111d3e99be218feafa2bdcfb903157b1acbb57e65'
skipping: [collectd-host-overview-influxdb-20210522-180746949622-cont]
TASK [Store hostname as "desiredhostname"] *****************************************************************************************************************************************************************************************************************
loaded from cache: 'sha256:c8f0e9152dc4200925eb700d770bd251cc622f36c0f88d0d79671f794cd6b894'
skipping: [collectd-host-overview-influxdb-20210522-180746949622-cont]
TASK [debug] ***********************************************************************************************************************************************************************************************************************************************
loaded from cache: 'sha256:3a6d887b77ce25ccce2da80d6664abd9b7d7614cfc229c95538f81f26b69f66b'
skipping: [collectd-host-overview-influxdb-20210522-180746949622-cont]
[..]
TASK [Copy & adept collectd.conf] **************************************************************************************************************************************************************************************************************************
fatal: [collectd-host-overview-influxdb-20210522-180746949622-cont]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'desiredhostname' is undefined"}
PS: I really like ansible-bender - and I understand its a tough job to run a 1-man project like this. Please consider this as a request for input - not a complaint :-)
Is there a good way around this issue - besides building from scratch every time?
Itsmee
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working