# It's raining new modules! Time to test them!

**URL:** <https://forum.ansible.com/t/its-raining-new-modules-time-to-test-them/11845>\
**Category:** Ansible Project\
**Created:** [August 30, 2012, 11:38pm UTC](https://forum.ansible.com/t/its-raining-new-modules-time-to-test-them/11845 "2012-08-30T23:38:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [August 30, 2012, 11:38pm UTC](https://forum.ansible.com/t/its-raining-new-modules-time-to-test-them/11845/1 "2012-08-30T23:38:42Z")

</div>

Maybe raining is not the word. More like "firestorm".

Documentation for the selinux, seboolean, lineinfile (newly  
refactored), nagios, and wait\_for modules are all up on the official  
documentation site on the modules page.

Please help test all of these, along with new language features (also  
documented on the advanced playbooks page) such as "delegate\_to" and  
"serial".

Documentation site is, of course: [http://ansible.github.com](http://ansible.github.com)

As a reminder, today's the feature freeze deadline for 0.7 -- and  
we'll release about the same time next week.

The changelogs are looking incredible --  
[https://github.com/ansible/ansible/blob/devel/CHANGELOG.md](https://github.com/ansible/ansible/blob/devel/CHANGELOG.md)

In other news, I've added a few more example playbooks and articles to  
the Ansible-Resources page -- such as Matt's vagrant tutorial and  
Chris Gedding's rather extensive playbook example --  
[https://github.com/ansible/ansible-resources/blob/master/README.md](https://github.com/ansible/ansible-resources/blob/master/README.md).  
It is very interesting to see how everyone is using things in  
different ways, so keep sharing great content like this!

--Michael

---

<div class="post-metadata">

**Author:** ![Time\_Less](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Time\_Less](https://forum.ansible.com/u/Time_Less)\
**Post date:** [September 5, 2012, 11:42pm UTC](https://forum.ansible.com/t/its-raining-new-modules-time-to-test-them/11845/2 "2012-09-05T23:42:43Z")

</div>

Yay lineinfile! Here’s my problem:

Source file has:

$DB[“USER”] = “zabbix”;  
Desired:

$DB[“USER”] = “\<interpolate playbook variable $mysql\_Zabbix\_user\>”;

Here’s what I’ve tried so far:

action: lineinfile name=/etc/zabbix/dbconfig.php regexp=^$DB[“USER”] line=‘$DB[“USER”] = “$mysql\_Zabbix\_user”’  
action: lineinfile name=/etc/zabbix/dbconfig.php regexp=^$DB[“USER”] line=‘$DB[“USER”] = "$mysql\_Zabbix\_user"’

action: lineinfile name=/etc/zabbix/dbconfig.php regexp=‘^$DB[“USER”]’ line=‘$DB[“USER”] = “$mysql\_Zabbix\_user”’  
action: lineinfile name=/etc/zabbix/dbconfig.php regexp=‘^$$DB[“USER”]’ line=‘$DB[“USER”] = “$mysql\_Zabbix\_user”’

action: lineinfile name=/etc/zabbix/dbconfig.php regexp=‘^$DB[“USER”]’ line=‘$DB[“USER”] = “$mysql\_Zabbix\_user”’

All of which give this error:

failed: [host] =\> {“failed”: true, “msg”: “line= doesn’t match regexp=”}

The debug output seems only slightly-useful:

REMOTE\_MODULE lineinfile name=/etc/zabbix/dbconfig.php regexp=^$DB[“USER”] line=‘$DB[“USER”] = “monitorZabbix”’

I’m not sure from examples what the regexp escaping rules are, nor what the generic playbook escaping rules are, and it looks like I’ll need to understand both to get this case to work properly.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 6, 2012, 12:30am UTC](https://forum.ansible.com/t/its-raining-new-modules-time-to-test-them/11845/3 "2012-09-06T00:30:03Z")

</div>

Confucious says, "If a man has a problem, and solves it with a regex,  
man now has two problems".

Thankfully, it's not that bad.

Remember that "$" represents "end of string" in a Python regular  
expression, and that "[" and "]" are also meaningful. The escape  
character is "\" and not "$".

This worked for me:

&nbsp;&nbsp;&nbsp;&nbsp;action: lineinfile name=/tmp/testfile regexp='^\$DB\[\"USER\"\]'  
line='$DB["USER"] = "foo"'

---

<div class="post-metadata">

**Author:** ![Time\_Less](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Time\_Less](https://forum.ansible.com/u/Time_Less)\
**Post date:** [September 6, 2012, 5:29pm UTC](https://forum.ansible.com/t/its-raining-new-modules-time-to-test-them/11845/4 "2012-09-06T17:29:00Z")

</div>

Aha! Escape all of $, [,], quotes. That works for me, too. For posterity, the actual code I’m now using in my Playbook is:

action: lineinfile name=/etc/zabbix/dbconfig.php regexp=‘^$DB["USER"]’ line=‘$DB[“USER”] = “$mysql\_Zabbix\_user”’

This might be a useful example for the lineinfile module documentation.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 6, 2012, 5:31pm UTC](https://forum.ansible.com/t/its-raining-new-modules-time-to-test-them/11845/5 "2012-09-06T17:31:10Z")

</div>

FWIW, you should not need to escape quotes, but that is sometimes  
easier than telling what is "'" and what is '"' when they are all run  
up against one another.
