![Mark Goddard](/assets/img/avatar_default.png)
Update Apt cache prior to all package installation tasks. Adds apt_cache_valid_time, which defaults to 3600 seconds. This allows the time for which the Apt cache is valid to be configured. Change-Id: I0ecf4f4ce9b7333d3e41c69c3f908bee83391781 Story: 2004960 Task: 41766
20 lines
596 B
YAML
20 lines
596 B
YAML
---
|
|
- name: Ensure iptables is installed
|
|
package:
|
|
name: iptables
|
|
cache_valid_time: "{{ apt_cache_valid_time if ansible_os_family == 'Debian' else omit }}"
|
|
update_cache: "{{ True if ansible_os_family == 'Debian' else omit }}"
|
|
become: true
|
|
|
|
# iptables -t nat -A POSTROUTING -o {{ interface }} -j SNAT --to-source {{ source_ip }}
|
|
- name: Ensure SNAT iptables rules exist
|
|
iptables:
|
|
action: append
|
|
table: nat
|
|
chain: POSTROUTING
|
|
out_interface: "{{ item.interface }}"
|
|
jump: SNAT
|
|
to_source: "{{ item.source_ip }}"
|
|
with_items: "{{ snat_rules }}"
|
|
become: True
|