I have the following in my playbook. (As a side note, I am unsure of my syntax under “with_items”. I have tried multiple variations, but I always get the same error. I just need another set of eyes to point out my problem):
`
43 - name: Set tuning parameters in sysctl.conf
44 lineinfile:
45 path: /etc/sysctl.conf
46 state: present
47 line: “{{item.replace_with}}”
48 regexp: “{{item.regex}}”
49 with_items:
50 - { replace_with: ‘net.core.netdev_max_backlog = {{backlog_value}}’,
51 regexp: ‘^net.netdev_max_backlog.’ }
52 - { replace_with: ‘net.core.rmem_max = {{bdp|int}}’,
53 regexp: ‘^net.core.rmem_max.’ }
54 - { replace_with: ‘net.core.wmem_max = {{bdp|int}}’,
55 regexp: ‘^net.core.wmem_max.’ }
56 - { replace_with: ‘net.ipv4.tcp_moderate_rcvbuf = 1’,
57 regexp: '^net.ipv4.tcp_moderate_rcvbuf.’ }
58 - { replace_with: ‘net.ipv4.tcp_rmem = 4096 87380 {{bdp|int}}’,
59 regexp: '^net.ipv4.tcp_rmem.’ }
60 - { replace_with: ‘net.ipv4.tcp_wmem = 4096 87380 {{bdp|int}}’,
61 regexp: ‘^net.ipv4.tcp_wmem.*’ }
62 #notify: sysctl_trigger
`
I get the following error. You can see from the output that “bdp|int” is populated, as is “backlog_value”. I don’t know what it is bombing on.
`
TASK [hugepages : Debug 2] ***************************************************************************************************************************************************************************************************************
ok: [ansibletest-oel6] => {
“bdp|int”: “1603750000”
}
TASK [hugepages : Debug 3] ***************************************************************************************************************************************************************************************************************
ok: [ansibletest-oel6] => {
“backlog_value”: “300000”
}
TASK [hugepages : Set tuning parameters in sysctl.conf] **********************************************************************************************************************************************************************************
fatal: [ansibletest-oel6]: FAILED! => {“failed”: true, “msg”: “the field ‘args’ has an invalid value, which appears to include a variable that is undefined. The error was: ‘dict object’ has no attribute ‘regex’\n\nThe error appears to have been in ‘/etc/ansible/roles/hugepages/tasks/main.yml’: line 43, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set tuning parameters in sysctl.conf\n ^ here\n”}
PLAY RECAP *******************************************************************************************************************************************************************************************************************************
ansibletest-oel6 : ok=8 changed=0 unreachable=0 failed=1
`