
The following Ansible playbook will install CentrifyDC express via yum or rpm depending on the OS. The CentrifyDC express package allows you bind Linux servers to your Active Directory server. This will allow you to ssh to your Linux servers using your AD credentials and use AD groups for sudoers access. It comes in pretty handy if you want to manage Linux accounts in one central place versus managing local accounts on each Linux server.
---
- name: Configure unbuntu/centos server with centrify
hosts: aofl-run
become: yes
become_user: root
vars_files:
- /etc/ansible/group_vars/crypto.yml
vars:
- u: '{{ centrify_user }}'
- p: '{{ centrify_password }}'
tasks:
- name: install archive repo trusty
#apt_repository: repo='deb http://archive.canonical.com/ trusty partner' state=present
apt_repository: repo='deb http://archive.canonical.com/ maverick partner' state=present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: install Ubuntu centrifydc package
apt: name=centrifydc update_cache=yes state=present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: install CentOS centrifydc package
yum: name=http://ansible.company.com/centrifydc-5.3.1-rhel4-x86_64.rpm state=present
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
- name: Updating centrify.conf private.group
lineinfile: "dest=/etc/centrifydc/centrifydc.conf line='auto.schema.private.group: false'"
- name: Updating centrify.conf private.gid
lineinfile: "dest=/etc/centrifydc/centrifydc.conf line='auto.schema.primary.gid: 272630273'"
- name: checking centrifydc package is not installed
command: dpkg-query -W centrifydc
register: centrifydc_check_deb
failed_when: centrifydc_check_deb.rc > 1
changed_when: centrifydc_check_deb.rc == 1
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- shell: adlicense -l; adjoin -w corp.company.com -c "OU=Servers,DC=corp,DC=company,DC=com" -u "{{ centrify_user }}" -p "{{ centrify_password }}"
no_log: False
roles:
- { role: slack, message: '{{ inventory_hostname }} system joined the AD domain'}
Tagged With: Ansible, CentrifyDC
Facebook Comments