Closed jamesalford closed 3 years ago
Worked around this with this:
- name: check for config file
stat:
path: /etc/postfix/main.cf
register: postfix_conf
- name: change IP address
lineinfile:
path: /etc/postfix/main.cf
regexp: '^inet_interfaces = '
line: 'inet_interfaces = {{ ansible_default_ipv4.address }}'
when: postfix_conf.stat.exists
register: change_ip
- name: restart service
service: name=postfix state=restarted
when: change_ip.changed
Closing due to inactivity
Set IP address to a.b.c.d on the server Run this role
Change IP address to a.b.c.e
Run the role again and apt fails at running newaliases step Running newaliases newaliases: fatal: parameter inet_interfaces: no local interface found for a.b.c.d
Looks like the fact is updated for ansible_default_ipv4.address but because apt install step is before the config for postfix the error occurs.