{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/9535","labels_url":"https://api.github.com/repos/ansible/ansible/issues/9535/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/9535/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/9535/events","html_url":"https://github.com/ansible/ansible/pull/9535","id":48323697,"number":9535,"title":"netmask_to_cidr function added","user":{"login":"cransom","id":1957293,"avatar_url":"https://avatars.githubusercontent.com/u/1957293?v=3","gravatar_id":"","url":"https://api.github.com/users/cransom","html_url":"https://github.com/cransom","followers_url":"https://api.github.com/users/cransom/followers","following_url":"https://api.github.com/users/cransom/following{/other_user}","gists_url":"https://api.github.com/users/cransom/gists{/gist_id}","starred_url":"https://api.github.com/users/cransom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cransom/subscriptions","organizations_url":"https://api.github.com/users/cransom/orgs","repos_url":"https://api.github.com/users/cransom/repos","events_url":"https://api.github.com/users/cransom/events{/privacy}","received_events_url":"https://api.github.com/users/cransom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/feature_pull_request","name":"feature_pull_request","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2014-11-10T22:37:44Z","updated_at":"2016-01-27T10:42:05Z","closed_at":"2015-06-15T15:28:09Z","pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/9535","html_url":"https://github.com/ansible/ansible/pull/9535","diff_url":"https://github.com/ansible/ansible/pull/9535.diff","patch_url":"https://github.com/ansible/ansible/pull/9535.patch"},"body":"To help convert between netmasks given in the facts to a CIDR\r\nvalue, supply a jinja function to help us out.\r\n\r\nThis was discussed in https://github.com/ansible/ansible/issues/8584 but it doesn't look like anyone tried to get it in the tree."},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/175545749","html_url":"https://github.com/ansible/ansible/pull/9535#issuecomment-175545749","issue_url":"https://api.github.com/repos/ansible/ansible/issues/9535","id":175545749,"user":{"login":"oneswig","id":14276704,"avatar_url":"https://avatars.githubusercontent.com/u/14276704?v=3","gravatar_id":"","url":"https://api.github.com/users/oneswig","html_url":"https://github.com/oneswig","followers_url":"https://api.github.com/users/oneswig/followers","following_url":"https://api.github.com/users/oneswig/following{/other_user}","gists_url":"https://api.github.com/users/oneswig/gists{/gist_id}","starred_url":"https://api.github.com/users/oneswig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oneswig/subscriptions","organizations_url":"https://api.github.com/users/oneswig/orgs","repos_url":"https://api.github.com/users/oneswig/repos","events_url":"https://api.github.com/users/oneswig/events{/privacy}","received_events_url":"https://api.github.com/users/oneswig/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T10:42:05Z","updated_at":"2016-01-27T10:42:05Z","body":"Thanks jtognazzi, I get what I need with this two-stage expansion of the system facts:\r\n\r\n    net_mask: \"{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.netmask }}\"\r\n    cidr_prefix: \"{{ net_mask|ipaddr('prefix') }}\"\r\n\r\nLooking through [the ipaddr page](http://docs.ansible.com/ansible/playbooks_filters_ipaddr.html#getting-information-from-host-prefix-values) at docs.ansible.com, I don't see any reference to `ipaddr('prefix')` taking input of the form (say) `192.168.15.240/255.255.255.240` - can this issue be converted into a documentation bug?  I think this would be particularly helpful given the form in which networking facts are reported."}}