wrk 2023-07-14 10-06-21
ans
--- - hosts: all become: yes tasks: - name: Check IPv4 address shell: ip addr show eth0 | grep "inet " | awk '{print $2}' | cut -d "/" -f 1 register: ipv4_address - name: Create a file with attributes when: ipv4_address == "12.13.14.15" file: path: /etc/my_attributes.yaml state: touch - name: Set attributes in file when: ipv4_address == "12.13.14.15" template: src: my_attributes.yaml.j2 dest: /etc/my_attributes.yaml vars: foo: bar baz: qux