{"id":7313,"date":"2018-04-06T08:49:01","date_gmt":"2018-04-06T00:49:01","guid":{"rendered":"http:\/\/rmohan.com\/?p=7313"},"modified":"2018-04-06T08:49:01","modified_gmt":"2018-04-06T00:49:01","slug":"limits-conf-with-ansible","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7313","title":{"rendered":"limits.conf with ansible"},"content":{"rendered":"<p>[root@localhost ~]# <strong>ansible-galaxy init <span class=\"skimlinks-unlinked\">limits.conf<\/span><\/strong><br \/>\n\u2013 <span class=\"skimlinks-unlinked\">limits.conf<\/span> was created successfully<\/p>\n<p>[root@localhost ~]# <strong>ansible-doc pam_limits<\/strong><\/p>\n<p>[root@localhost ~]# <strong>vim <span class=\"skimlinks-unlinked\">limits.conf\/tasks\/main.yml<\/span><\/strong><br \/>\n\u2014<br \/>\n# tasks file for <span class=\"skimlinks-unlinked\">limits.conf<\/span><br \/>\n\u2013 pam_limits:<br \/>\ndomain: \u201c{{ item.domain }}\u201d<br \/>\nlimit_type: \u201c{{ item.limit_type }}\u201d<br \/>\nlimit_item: \u201c{{ item.limit_item }}\u201d<br \/>\nvalue: \u201c{{ <span class=\"skimlinks-unlinked\">item.value<\/span> }}\u201d<br \/>\nwith_items: \u201c{{ limits_conf_settings }}\u201d<\/p>\n<p>[root@localhost ~]# <strong>vim <span class=\"skimlinks-unlinked\">limits_conf.yml<\/span><\/strong><br \/>\n\u2014<br \/>\n\u2013 hosts: all<br \/>\nroles:<br \/>\n\u2013 <span class=\"skimlinks-unlinked\">limits.conf<\/span><br \/>\nvars:<br \/>\nlimits_conf_settings:<br \/>\n\u2013 domain: joe<br \/>\nlimit_type: soft<br \/>\nlimit_item: nofile<br \/>\nvalue: 64000<\/p>\n<p>[root@localhost ~]# <strong>ansible-playbook <span class=\"skimlinks-unlinked\">limits_conf.yml<\/span> -C<\/strong><\/p>\n<p>PLAY [all] *************************************************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] *************************************************************************************************************************<br \/>\nok: [localhost]<\/p>\n<p>TASK [<span class=\"skimlinks-unlinked\">limits.conf<\/span> : pam_limits] ****************************************************************************************************************<br \/>\nskipping: [localhost] =&gt; (item={u\u2019domain\u2019: u\u2019joe\u2019, u\u2019limit_item\u2019: u\u2019nofile\u2019, u\u2019limit_type\u2019: u\u2019soft\u2019, u\u2019value\u2019: 64000})<\/p>\n<p>PLAY RECAP *************************************************************************************************************************************<br \/>\nlocalhost : ok=1 changed=0 unreachable=0 failed=0<\/p>\n<p>[root@localhost ~]#<strong> ansible-playbook <span class=\"skimlinks-unlinked\">limits_conf.yml<\/span><\/strong><\/p>\n<p>PLAY [all] *************************************************************************************************************************************<\/p>\n<p>TASK [Gathering Facts] *************************************************************************************************************************<br \/>\nok: [localhost]<\/p>\n<p>TASK [<span class=\"skimlinks-unlinked\">limits.conf<\/span> : pam_limits] ****************************************************************************************************************<br \/>\nchanged: [localhost] =&gt; (item={u\u2019domain\u2019: u\u2019joe\u2019, u\u2019limit_item\u2019: u\u2019nofile\u2019, u\u2019limit_type\u2019: u\u2019soft\u2019, u\u2019value\u2019: 64000})<\/p>\n<p>PLAY RECAP *************************************************************************************************************************************<br \/>\nlocalhost : ok=2 changed=1 unreachable=0 failed=0<\/p>\n<p>[root@localhost ~]#<strong> tail -n1 \/etc\/security\/<span class=\"skimlinks-unlinked\">limits.conf<\/span><\/strong><br \/>\njoe soft nofile 64000<\/p>\n<p>[root@localhost ~]#<strong> su \u2013 joe<\/strong><br \/>\nLast login: Wed Sep 13 09:05:21 IST 2017 on pts\/0<br \/>\n[joe@localhost ~]$ <strong>ulimit -Sn<\/strong><br \/>\n64000<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[root@localhost ~]# ansible-galaxy init limits.conf \u2013 limits.conf was created successfully<\/p>\n<p>[root@localhost ~]# ansible-doc pam_limits<\/p>\n<p>[root@localhost ~]# vim limits.conf\/tasks\/main.yml \u2014 # tasks file for limits.conf \u2013 pam_limits: domain: \u201c{{ item.domain }}\u201d limit_type: \u201c{{ item.limit_type }}\u201d limit_item: \u201c{{ item.limit_item }}\u201d value: \u201c{{ item.value }}\u201d with_items: \u201c{{ limits_conf_settings }}\u201d<\/p>\n<p>[root@localhost ~]# vim limits_conf.yml \u2014 \u2013 hosts: all roles: [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[91],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7313"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7313"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7313\/revisions"}],"predecessor-version":[{"id":7314,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7313\/revisions\/7314"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}