{"id":408,"date":"2017-11-13T19:17:58","date_gmt":"2017-11-13T18:17:58","guid":{"rendered":"https:\/\/ilmarkerm.eu\/blog\/?p=408"},"modified":"2017-11-13T19:22:38","modified_gmt":"2017-11-13T18:22:38","slug":"syncronising-users-from-active-directory-to-oracle-database-using-ansible","status":"publish","type":"post","link":"https:\/\/ilmarkerm.eu\/blog\/2017\/11\/syncronising-users-from-active-directory-to-oracle-database-using-ansible\/","title":{"rendered":"Syncronising users from Active Directory to Oracle Database using Ansible"},"content":{"rendered":"<p>We have hundreds of developers who need access to production database for incident management purposes. But we don&#8217;t want to use shared accounts to access the database, each user has their own access to the database that is audited and has privileges according to the users access level.<br \/>\nManaging all these users manually on Oracle Database side is just too much, especially that all their access details are already described in Active Directory. Wouldn&#8217;t it be nice if we can just syncronise the AD users to the database side? Luckily we have an Ansible module for this task.<\/p>\n<p>First, on the database side need to create a dedicated profile for the syncronised users:<\/p>\n<pre><code class=\"sql\">CREATE PROFILE ldap_user LIMIT password_life_time UNLIMITED;\n<\/code><\/pre>\n<p>I assume you are already familiary with <a href=\"https:\/\/www.ansible.com\/\">Ansible<\/a>, so I&#8217;ll go straight to the point.<br \/>\nFirst you need to clone the ansible-oracle-modules to your playbook directory:<\/p>\n<pre><code>git clone https:\/\/github.com\/oravirt\/ansible-oracle-modules library\n<\/code><\/pre>\n<p>This contains, among other goodies, a module that does exactly what is required \ud83d\ude42 The module is called <strong>oracle_ldapuser<\/strong>.<br \/>\nThis module requires extra python-ldap module to be installed. Install it using yum, not pip. Pip will install wrong version.<\/p>\n<pre><code>yum install python-ldap\n<\/code><\/pre>\n<p>The playbook looks like this:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/ilmarkerm\/ef580edc7fd9dfd678140d9efa7036ef.js\"><\/script><\/p>\n<p>Remember that it is a syncronisation, so new users are created and removed when the playbook is run.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have hundreds of developers who need access to production database for incident management purposes. But we don&#8217;t want to use shared accounts to access the database, each user has their own access to the database that is audited and has privileges according to the users access level. Managing all these users manually on Oracle [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[22,53,4],"class_list":["post-408","post","type-post","status-publish","format-standard","hentry","category-blog-entry","tag-active-directory","tag-ansible","tag-oracle"],"_links":{"self":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/comments?post=408"}],"version-history":[{"count":3,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions"}],"predecessor-version":[{"id":411,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions\/411"}],"wp:attachment":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/media?parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/categories?post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/tags?post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}