So I just want to state that I’m new to Ansible and not sure how to debug issues yet, any guidance would be appreciated.
I’m attempting to use module blockinfile to update /etc/sysctl.conf file, but it doesn’t seem to want to cooperate.
playbook:
settings.yml
1 —
2 - hosts: dbservers
3 become: yes
4
5 tasks:
6 - name: insert/update sysctl.conf settings per specifications
7 blockinfile:
8 backup: yes
9 dest: /etc/sysctl.conf
10 marker: # {mark} ANSIBLE MANAGED BLOCK
11 content: |
12 kernel.shmmni = 4096
13 kernel.sem = 250 32000 100 128
14 fs.file-max = 512 * PROCESSES
15 net.ipv4.ip_local_port_range = 1024 6500
16 net.core.rmem_default = 4194304
17 net.core.rmem_max = 4194304
18 net.core.wmem_default = 262144
19 net.ipv4.tcp_wmem = 262144 262144 262144
20 net.ipv4.tcp_rmem = 4194304 4194304 4194304
execution:
$ ansible-playbook ./playbooks/settings.yml
results:
PLAY [dbservers] ***************************************************************
TASK [setup] *******************************************************************
ok: [ag-rhel6-temp.test.local]
TASK [insert/update sysctl.conf settings per specifications] ****************
fatal: [ag-rhel6-temp.test.local]: FAILED! => {“changed”: false, “failed”: true, “module_stderr”: “”, “module_stdout”: “Traceback (most recent call last):\r\n File "/tmp/ansible_3oLmj8/ansible_module_blockinfile.py", line 313, in \r\n main()\r\n File "/tmp/ansible_3oLmj8/ansible_module_blockinfile.py", line 243, in main\r\n marker0 = re.sub(r’{mark}', ‘BEGIN’, marker)\r\n File "/usr/lib64/python2.6/re.py", line 151, in sub\r\n return _compile(pattern, 0).sub(repl, string, count)\r\nTypeError: expected string or buffer\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}
NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @./playbooks/settings.retry
PLAY RECAP *********************************************************************
ag-rhel6-temp.test.local : ok=1 changed=0 unreachable=0 failed=1
Again, any help or pointers would be appreciated!
Thanks,
Rick