SlideShare a Scribd company logo
Automate DBA
Tasks With Ansible
Automation
Ivica Arsov – November 18, 2017
Ivica Arsov
Database Consultant
• Oracle Certified Master 12c & 11g
• Oracle ACE Associate
• Blogger
Twitter: IvicaArsov
Blog: https://iarsov.com
(c) The Pythian Group Inc., 2017 2
3 Membership Tiers
• Oracle ACE Director
• Oracle ACE
• Oracle ACE Associate bit.ly/OracleACEProgram
500+ Technical
Experts Helping
Peers Globally
Connect:
Nominate yourself or someone you know: acenomination.oracle.com
@oracleace
Facebook.com/oracleaces
oracle-ace_ww@oracle.com
Conferences speaker for
4
ABOUT PYTHIAN
Pythian’s 400+ IT professionals
help companies adopt and
manage disruptive technologies
to better compete
(c) The Pythian Group Inc., 2017 5
TECHNICAL EXPERTISE
(c) The Pythian Group Inc., 2017 6
Infrastructure: Transforming and
managing the IT infrastructure
that supports the business
DevOps: Providing critical velocity
in software deployment by adopting
DevOps practices
Cloud: Using the disruptive
nature of cloud for accelerated,
cost-effective growth
Databases: Ensuring databases
are reliable, secure, available and
continuously optimized
Big Data: Harnessing the transformative
power of data on a massive scale
Advanced Analytics: Mining data for
insights & business transformation
using data science
AGENDA
Introduction to Ansible
Installation
Playbooks
Roles
Templates
Modules and custom modules
Live demo – automatic Oracle patching
(c) The Pythian Group Inc., 2017 7
Ansible introduction
and installation
ansible engine
• Open - source automation engine
• Owned by RedHat
▪ Available for Red Hat Enterprise Linux, CentOS, Debian, Ubuntu, OEL …
▪ Windows support - only as a target machine
• Written in Python
• Agentless architecture
• Git repository: https://github.com/ansible/ansible
(c) The Pythian Group Inc., 2017 9
ansible consist of …
architecture
• Inventory configuration
• Modules
• Playbooks
• Roles
(c) The Pythian Group Inc., 2017 10
ansible architecture
architecture
• Two types of servers: controlling machines and nodes (targets)
• Targets are managed by a controlling machine over SSH, WINRM
(c) The Pythian Group Inc., 2017 11
control machine
web servers
database servers
orchestrates (SSH, WINRM) no agents
ansible installation
• RPMs for Enterprise Linux 6, 7 are available from yum via EPEL
http://fedoraproject.org/wiki/EPEL
• Add EPEL on OEL7, RHEL7 or CentOS
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install epel-release-latest-7.noarch.rpm
• Install Ansible
yum install ansible
(c) The Pythian Group Inc., 2017 12
ansible installation
OSX
• Installation is done via pip
• Install Xcode
• Install pip and ansible
sudo easy_install pip
pip install ansible
• For more information see:
http://docs.ansible.com/ansible/intro_installation.html#latest-release-via-yum
(c) The Pythian Group Inc., 2017 13
ansible configuration files
• Ansible configuration file: /etc/ansible/ansible.cfg
• Define the hosts in a ‘hosts’ file, by default in /etc/ansible/hosts
List all defined hosts: ansible all --list-hosts
(c) The Pythian Group Inc., 2017 14
...
db8.example.org
[webservers]
app1.example.org
app2.example.org
[dbservers]
db1.example.org ansible_host=... ansible_port=... ansible_ssh_private_key_file=... ansible_user=...
db2.example.org
ansible – windows support
• Control machine requires pywinrm, a Python module for the Windows Remote
Management (WinRM)
(c) The Pythian Group Inc., 2017 15
Option Local Accounts Active Directory Accounts Credential Delegation
Basic Yes No No
Certificate Yes No No
Kerberos No Yes Yes
NTLM Yes Yes No
CredSSP Yes Yes Yes
ansible – windows support
example configuration with kerberos
• Kerberos configuration file /etc/krb5.conf
(c) The Pythian Group Inc., 2017 16
...
[realms]
WINGROUP.AD = {
kdc = win-hrms-srv.WINGROUP.AD
admin_server = win-hrms-srv.WINGROUP.AD
default_domain = WINGROUP.AD
}
[domain_realm]
.wingroup.ad = WINGROUP.AD
wingroup.ad = WINGROUP.AD
ansible – windows support
‘hosts’ file
• Inventory/hosts
(c) The Pythian Group Inc., 2017 17
...
[windows]
win-hrms-srv.wingroup.ad
[windows:vars]
ansible_user = iarsov@WINGROUP.AD
ansible_password = ********
ansible_connection = winrm
ansible_port = 5986
ansible_winrm_server_cert_validation =ignore
Modules
modules
• Library plugins , always are executed on target machine
• Ansible comes with large number of modules
• Each module supports specific number of arguments
(c) The Pythian Group Inc., 2017 19
ansible vm12r1 -m copy -a "src=/tmp/file.txt dest=/tmp/file.txt"
SSH password:
vm12r1 | SUCCESS => {
"changed": true,
"checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
"dest": "/tmp/file.txt",
"gid": 500,
"group": "dba",
...
}
target module argumentargument
custom modules
developing modules
• First check if similar module already exist
• http://docs.ansible.com/ansible/latest/list_of_all_modules.html
• GitHub (all module updates): https://github.com/ansible/ansible/labels/module
• Not enough documentation regarding development
• If you want additional checks on control machine use action_plugins
(c) The Pythian Group Inc., 2017 20
• Test module date.py code
(c) The Pythian Group Inc., 2017 21
developing modules
our first custom module
#!/usr/bin/python
import datetime
import json
date = str(datetime.datetime.now())
print(json.dumps({
"time" : date
}))
ansible ansible-demo --module-path=/home/ansible -m date
ansible-demo | SUCCESS => {
"changed": false,
"time": "2017-08-31 14:48:10.978621”
}
ansible execution
• The modules are copied and executed on target machines
• Destination can be controlled with local_tmp in ansible.cfg
Execution steps:
1. Create local temporary directory: $HOME/.ansible/tmp/ansible-tmp-xxx/ansiballz_cache
2. Copy module
3. Execute module
4. Return result in JSON format
5. Clear (remove) ansible-tmp-xxx/ansiballz_cache
(c) The Pythian Group Inc., 2017 22
ad-hoc task execution
• The “ping” example
• Ad-hoc tasks are run with ansible command
• Ansible uses SSH authentication, you need to specify an user
(c) The Pythian Group Inc., 2017 23
ansible vm12r1 -m ping -u root -k
SSH password:
vm12r1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
target module user
Playbooks
YAML basic rules
YAML Ain't Markup Language
• Human readable data structure
• Less complex than JSON or XML
• YAML is case sensitive
• Does not allow tabs. You must use spaces.
YAML XML
(c) The Pythian Group Inc., 2017 25
db_list:
- oracle_owner: oracle
oracle_home: /u01/app...
sid: orcl
...
<db_list>
<oracle_owner>oracle</oracle_owner>
<oracle_home>/u01/app...</oracle_home>
<sid>orcl</sid>
...
</db_list>
• Organize the “play” tasks
• Playbook’s language is YAML
• Each play contains set of tasks
• Tasks are executed one at a time in order
against all matched targets
• Command ansible-playbook
Play example:
playbook.yml
- hosts: dbservers
user: root
tasks:
- name: ping hostname
ping:
- name: create directory
file: path=/home/ansible/bgoug2017 state=directory
playbooks
(c) The Pythian Group Inc., 2017 26
- hosts: dbservers
user: root
tasks:
- name: ping hostname
ping:
- hosts: webservers
user: root
tasks:
- name: create directory
file: path=/home/ansible/bgoug2017 state=directory
• Playbooks can contain multiple plays
• Split tasks performed per different host groups
playbooks
(c) The Pythian Group Inc., 2017 27
Variables file definition (var_def.yml)
Playbook file definition
- hosts: “{{ hostname }}“
user: “{{ user }}“
vars_files:
- var_def.yml
tasks:
- name: create directory
file: path={{ dir_path }} state=directory
using variables
variables
(c) The Pythian Group Inc., 2017 28
hostname: ansible-demo
dir_path: /home/ansible/bgoug2017
user: root
• Variables are used using the Jinja2
templating system
• You can also use variables in Templates
• Variables are referenced with double
curly brackets: {{ variable_name }}
variables
(c) The Pythian Group Inc., 2017 29
- hosts: “{{ hostname }}“
user: “{{ user }}“
tasks:
- name: create directory
file: path={{ dir_path }} state=directory
vars:
- hostname: ansible-demo
user: root
dir_path: /home/ansible/bgoug2017
• Variables can be defined within the playbook
variables
(c) The Pythian Group Inc., 2017 30
ansible-playbook demo2.yml -k --extra-vars="dir_path=/home/ansible/bgoug2017 user=root
hostname=ansible-demo“
SSH password:
PLAY [ansible-demo]
***************************************************************************************
ok: [ansible-demo]
TASK [create directory]
***************************************************************************************
ok: [ansible-demo]
PLAY RECAP
***************************************************************************************
ansible-demo : ok=2 changed=0 unreachable=0 failed=0
• Variables can also be defined from command line
ansible – windows support
• Playbook wintest.yml
(c) The Pythian Group Inc., 2017 31
---
- name: Windows demo
hosts: windows
tasks:
- name: Create directory "D:ansiblebgoug2017"
win_command: Powershell.exe "mkdir D:ansiblebgoug2017"
Roles and Templates
roles
how to organize the tasks?
• Represent “automation” within ansible
• You can define variables for all roles or per role
• Not complex at all. No hidden magic.
• Supports automatic load of main.yml file for tasks, handlers, variables, meta
definitions and role “default” variables
(c) The Pythian Group Inc., 2017 33
site.yml
dbswinstall.yml
roles/
dbinstall/
files/
templates/
tasks/
main.yml
handlers/
vars/
main.yml
defaults/
...
*main.yml files are automatically loaded
dbswinstall.yml snippet:
---
- hosts: chicago
user: oracle
roles:
- hostconfig
- dbinstall
- dbmonitor
dbservers role
project structure
role
playbook
variable definitions
tasks definitions
(c) The Pythian Group Inc., 2017 34
role dependencies
• Role dependencies are defined in meta/main.yml file
• Allows you to reference other roles before running a role
(c) The Pythian Group Inc., 2017 35
---
dependencies:
- { role: common }
...
dbswinstall.yml
roles/
common/
dbinstall/
files/
meta/
main.yml
tasks/
...
Templates
Introduction to ansible templating
• Sometimes pre-defined configuration files are needed for installation
• An example is the Oracle dbca configuration file
• Templating allows ansible variables substitution within templates
(c) The Pythian Group Inc., 2017 36
Templates
...
#-------------------------------------------------------------------------------
# Specify the hostname of the system as set during the install. It can be used
# to force the installation to use an alternative hostname rather than using the
# first hostname found on the system. (e.g., for systems with multiple hostnames
# and network interfaces)
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME={{ ansible_hostname }}
#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME={{ oracle_group }}
...
(c) The Pythian Group Inc., 2017 37
Templates
• Source template file is copied to target destination and variables are substituted
(c) The Pythian Group Inc., 2017 38
- name: create 11g installer response file
template:
src: db_11204.rsp.j2
dest: /tmp/db_11204.rsp
owner: "{{ oracle_user }}"
group: "{{ oracle_group }}"
mode: 0640
Demo
Example: Oracle 11.2.0.4 software installation
oracle database install
installation of oracle 11.2.0.4 software
oracle_base: "/oracle/app/oracle"
oracle_home: "/oracle/app/oracle/product/11.2.0.4/db1"
oracle_user: oracle
oracle_group: dba
swlib_path: "/oracle/install"
db_edition: EE
DBComponents: "oracle.rdbms.partitioning:11.2.0.4.0"
(c) The Pythian Group Inc., 2017 40
oracle database install
installation of oracle 11.2.0.4 software
(c) The Pythian Group Inc., 2017 41
- name: create oracle base directory
file:
path: "{{ oracle_base }}"
state: directory
owner: "{{ oracle_user }}"
group: "{{ oracle_group }}"
mode: 0775
oracle database install
installation of oracle 11.2.0.4 software
(c) The Pythian Group Inc., 2017 42
- name: create 11g installer response file
template:
src: db_11204.rsp.j2
dest: /tmp/db_11204.rsp
owner: "{{ oracle_user }}"
group: "{{ oracle_group }}"
mode: 0640
oracle database install
installation of oracle 11.2.0.4 software
- name: install base software
command: "{{ swlib_path }}/11204/installer/database/runInstaller -silent
-ignorePrereq -ignoreSysPrereqs -waitforcompletion -responseFile
/tmp/db_11204.rsp"
register: install_db_software
args:
creates: "{{ oracle_home }}"
failed_when: "'skipped' not in install_db_software.stdout and
'Successfully Setup Software.' not in install_db_software.stdout“
(c) The Pythian Group Inc., 2017 43
oracle database install
installation of oracle 11.2.0.4 software
- name: run root-script orainstRoot.sh
command: "{{ oracle_base }}/../oraInventory/orainstRoot.sh"
when: "'skipped' not in install_db_software.stdout"
become: true
become_user: root
become_method: sudo
(c) The Pythian Group Inc., 2017 44
oracle database install
installation of oracle 11.2.0.4 software
- name: run root-script root.sh from ORACLE_HOME
command: "{{ oracle_home }}/root.sh"
when: "'skipped' not in install_db_software.stdout"
become: true
become_user: root
become_method: sudo
- name: clean up installer response file
file:
path: /tmp/db_11204.rsp
state: absent
(c) The Pythian Group Inc., 2017 45
orapatch
custom module
• Can be used to apply PSU on 10g, 11g and 12c
• Written in Python (~1500 lines of code)
In summary:
• You need to specify:
• oracle home path, PSU or DBBP patch ID, whether to patch only the oracle home
binaries, all databases or specific set of databases
• It will automatically:
• stop OH services, apply PSU or DBBP according specified settings, start back the
services as before the patching
(c) The Pythian Group Inc., 2017 46
always executed
orapatch
workflow
(c) The Pythian Group Inc., 2017 47
Check OPatch
minimum version
Check conflicts
against OH
Patch OH
Patch DB
Patch OH OJVM
Patch DB OJVM
End logger
session
Fetch orapatch
logfile
Start logger
session
Push SQL
scripts
- name: Patch oracle software
serial: 1
vars_prompt:
- name: "root_password"
prompt: "Enter root password (press enter to skip)"
private: yes
- name: "root_password_confirm"
prompt: "Enter root password again (press enter to skip)"
private: yes
pre_tasks:
- assert:
that: root_password == root_password_confirm
msg: "Root password missmatch."
hosts: database
user: oracle
roles:
- orapatch
(c) The Pythian Group Inc., 2017 48
orapatch
vars/main.yml
db_list:
- oracle_owner: oracle
oracle_home_path: /oracle/app/oracle/product/12.2.0.1/db1
patch_directory: "12.1.0.2/psu"
run_only_checks: False
patch: True
patch_id: 26129945
patch_only_oh: True
patch_ojvm: False
patch_db_all: False
patch_db_list: "orcl" patch specific databases
patch all databases for specified OH
apply OJVM PSU
patch only oracle specified oracle home
run only prerequisite checks
oracle home to patch
directory where patch binaries are located
(c) The Pythian Group Inc., 2017 49
patch_dict:
26129945:
patch_proactive_bp_id: 26129945
patch_gi_id:
patch_db_id: 25983138
patch_ocw_id: 26187629
patch_ojvm_id:
patch_acfs_id:
patch_dbwlm_id:
patch_dir: 26129945
file: p26129945_121020_Linux-x86-64.zip
only_oh: False
desc: "DATABASE PROACTIVE BUNDLE PATCH 12.2.0.1.170620”
26550339:
patch_proactive_bp_id:
patch_gi_id: 26610308
...
(c) The Pythian Group Inc., 2017 50
(c) The Pythian Group Inc., 2017 51
(c) The Pythian Group Inc., 2017 52
(c) The Pythian Group Inc., 2017 53
(c) The Pythian Group Inc., 2017 54
(c) The Pythian Group Inc., 2017 55
(c) The Pythian Group Inc., 2017 56
ansible blog posts
• AUTOMATINC ORACLE RMAN BACKUP CONFIGURATION ON LINUX WITH ANSIBLE
https://www.pythian.com/blog/automating-oracle-rman-backup-configuration-linux-ansible
• CREATING ANSIBLE CUSTOM MODULE FOR AWR REPORT GENERATION
https://www.pythian.com/blog/creating-ansible-custom-module-for-awr-reports-generation
• SIMPLE STEPS TO PERFORM OPATCH MAINTENANCE WITH ANSIBLE
https://www.pythian.com/blog/opatch-maintenance-with-ansible
• ANSIBLE AND AWS AUTOMATION
https://www.pythian.com/blog/ansible-and-aws-automation
More at: https://www.pythian.com/blog/?s=ansible
(c) The Pythian Group Inc., 2017 57
Thank you.
Questions?
(c) The Pythian Group Inc., 2017 58

More Related Content

What's hot

Oracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and AdministerOracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and Administer
Andrejs Karpovs
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
sriram_rajan
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
George Shuklin
 
MySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & OperationsMySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & Operations
Frederic Descamps
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
 
PLPgSqL- Datatypes, Language structure.pptx
PLPgSqL- Datatypes, Language structure.pptxPLPgSqL- Datatypes, Language structure.pptx
PLPgSqL- Datatypes, Language structure.pptx
johnwick814916
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
CoreStack
 
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best PracticesOracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
Markus Michalewicz
 
Percona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsPercona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient Backups
Mydbops
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
Ivan Serdyuk
 
How Netflix Tunes EC2 Instances for Performance
How Netflix Tunes EC2 Instances for PerformanceHow Netflix Tunes EC2 Instances for Performance
How Netflix Tunes EC2 Instances for Performance
Brendan Gregg
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
YoungHeon (Roy) Kim
 
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScaleThe Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
Colin Charles
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015PostgreSQL-Consulting
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
PostgreSQL-Consulting
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
Ricardo Schmidt
 
Oracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesOracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best Practices
Bobby Curtis
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
Julien Pivotto
 
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
ScaleGrid.io
 

What's hot (20)

Oracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and AdministerOracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and Administer
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
 
Best practices for ansible
Best practices for ansibleBest practices for ansible
Best practices for ansible
 
MySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & OperationsMySQL InnoDB Cluster - Advanced Configuration & Operations
MySQL InnoDB Cluster - Advanced Configuration & Operations
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
 
PLPgSqL- Datatypes, Language structure.pptx
PLPgSqL- Datatypes, Language structure.pptxPLPgSqL- Datatypes, Language structure.pptx
PLPgSqL- Datatypes, Language structure.pptx
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best PracticesOracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
Oracle Real Application Clusters (RAC) 12c Rel. 2 - Operational Best Practices
 
Percona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient BackupsPercona Xtrabackup - Highly Efficient Backups
Percona Xtrabackup - Highly Efficient Backups
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
How Netflix Tunes EC2 Instances for Performance
How Netflix Tunes EC2 Instances for PerformanceHow Netflix Tunes EC2 Instances for Performance
How Netflix Tunes EC2 Instances for Performance
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
 
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScaleThe Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
 
Oracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best PracticesOracle GoldenGate 21c New Features and Best Practices
Oracle GoldenGate 21c New Features and Best Practices
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
 

Similar to Automate DBA Tasks With Ansible

22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
Athens Big Data
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & docker
Jürgen Gutsch
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
Sabyrzhan Tynybayev
 
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...Michael Lee
 
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in PerlNagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
Nagios
 
Leveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioningLeveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioning
DataWorks Summit
 
Leveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioningLeveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioning
Evans Ye
 
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
European Collaboration Summit
 
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate EverythingMihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
Pantheon
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Cosimo Streppone
 
OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...
OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...
OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...
NETWAYS
 
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko "Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
Fwdays
 
R sharing 101
R sharing 101R sharing 101
R sharing 101
Omnia Safaan
 
Heroku to Kubernetes & Gihub to Gitlab success story
Heroku to Kubernetes & Gihub to Gitlab success storyHeroku to Kubernetes & Gihub to Gitlab success story
Heroku to Kubernetes & Gihub to Gitlab success story
Jérémy Wimsingues
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
Dimitar Damyanov
 
Viktor Tsykunov "Microsoft AI platform for every Developer"
Viktor Tsykunov "Microsoft AI platform for every Developer"Viktor Tsykunov "Microsoft AI platform for every Developer"
Viktor Tsykunov "Microsoft AI platform for every Developer"
Lviv Startup Club
 
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
Cloud Native NoVA
 
2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com
Mathieu Buffenoir
 

Similar to Automate DBA Tasks With Ansible (20)

22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
22nd Athens Big Data Meetup - 1st Talk - MLOps Workshop: The Full ML Lifecycl...
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & docker
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
 
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
Setup of EDA tools and workstation environment variables in NCTU 307 Lab. wor...
 
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in PerlNagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
Nagios Conference 2012 - Nathan Vonnahme - Writing Custom Nagios Plugins in Perl
 
Leveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioningLeveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioning
 
Leveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioningLeveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioning
 
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
 
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate EverythingMihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate Everything
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...
OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...
OSDC 2016 - Continous Integration in Data Centers - Further 3 Years later by ...
 
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko "Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
 
R sharing 101
R sharing 101R sharing 101
R sharing 101
 
Heroku to Kubernetes & Gihub to Gitlab success story
Heroku to Kubernetes & Gihub to Gitlab success storyHeroku to Kubernetes & Gihub to Gitlab success story
Heroku to Kubernetes & Gihub to Gitlab success story
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
 
Viktor Tsykunov "Microsoft AI platform for every Developer"
Viktor Tsykunov "Microsoft AI platform for every Developer"Viktor Tsykunov "Microsoft AI platform for every Developer"
Viktor Tsykunov "Microsoft AI platform for every Developer"
 
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
 
2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com
 

Recently uploaded

Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Sebastiano Panichella
 
Eureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 PresentationEureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 Presentation
Access Innovations, Inc.
 
Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
faizulhassanfaiz1670
 
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
OECD Directorate for Financial and Enterprise Affairs
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
khadija278284
 
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Orkestra
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
Howard Spence
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Sebastiano Panichella
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
Faculty of Medicine And Health Sciences
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Access Innovations, Inc.
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Matjaž Lipuš
 
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
0x01 - Newton's Third Law:  Static vs. Dynamic Abusers0x01 - Newton's Third Law:  Static vs. Dynamic Abusers
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
OWASP Beja
 
Getting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control TowerGetting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control Tower
Vladimir Samoylov
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
eCommerce Institute
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
Sebastiano Panichella
 
Acorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutesAcorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutes
IP ServerOne
 

Recently uploaded (16)

Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...Doctoral Symposium at the 17th IEEE International Conference on Software Test...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
 
Eureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 PresentationEureka, I found it! - Special Libraries Association 2021 Presentation
Eureka, I found it! - Special Libraries Association 2021 Presentation
 
Media as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern EraMedia as a Mind Controlling Strategy In Old and Modern Era
Media as a Mind Controlling Strategy In Old and Modern Era
 
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
Competition and Regulation in Professional Services – KLEINER – June 2024 OEC...
 
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdfBonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
Bonzo subscription_hjjjjjjjj5hhhhhhh_2024.pdf
 
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
Sharpen existing tools or get a new toolbox? Contemporary cluster initiatives...
 
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptxsomanykidsbutsofewfathers-140705000023-phpapp02.pptx
somanykidsbutsofewfathers-140705000023-phpapp02.pptx
 
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...Announcement of 18th IEEE International Conference on Software Testing, Verif...
Announcement of 18th IEEE International Conference on Software Testing, Verif...
 
Obesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditionsObesity causes and management and associated medical conditions
Obesity causes and management and associated medical conditions
 
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdfSupercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
Supercharge your AI - SSP Industry Breakout Session 2024-v2_1.pdf
 
Bitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXOBitcoin Lightning wallet and tic-tac-toe game XOXO
Bitcoin Lightning wallet and tic-tac-toe game XOXO
 
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
0x01 - Newton's Third Law:  Static vs. Dynamic Abusers0x01 - Newton's Third Law:  Static vs. Dynamic Abusers
0x01 - Newton's Third Law: Static vs. Dynamic Abusers
 
Getting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control TowerGetting started with Amazon Bedrock Studio and Control Tower
Getting started with Amazon Bedrock Studio and Control Tower
 
María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024María Carolina Martínez - eCommerce Day Colombia 2024
María Carolina Martínez - eCommerce Day Colombia 2024
 
International Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software TestingInternational Workshop on Artificial Intelligence in Software Testing
International Workshop on Artificial Intelligence in Software Testing
 
Acorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutesAcorn Recovery: Restore IT infra within minutes
Acorn Recovery: Restore IT infra within minutes
 

Automate DBA Tasks With Ansible

  • 1. Automate DBA Tasks With Ansible Automation Ivica Arsov – November 18, 2017
  • 2. Ivica Arsov Database Consultant • Oracle Certified Master 12c & 11g • Oracle ACE Associate • Blogger Twitter: IvicaArsov Blog: https://iarsov.com (c) The Pythian Group Inc., 2017 2
  • 3. 3 Membership Tiers • Oracle ACE Director • Oracle ACE • Oracle ACE Associate bit.ly/OracleACEProgram 500+ Technical Experts Helping Peers Globally Connect: Nominate yourself or someone you know: acenomination.oracle.com @oracleace Facebook.com/oracleaces oracle-ace_ww@oracle.com
  • 5. ABOUT PYTHIAN Pythian’s 400+ IT professionals help companies adopt and manage disruptive technologies to better compete (c) The Pythian Group Inc., 2017 5
  • 6. TECHNICAL EXPERTISE (c) The Pythian Group Inc., 2017 6 Infrastructure: Transforming and managing the IT infrastructure that supports the business DevOps: Providing critical velocity in software deployment by adopting DevOps practices Cloud: Using the disruptive nature of cloud for accelerated, cost-effective growth Databases: Ensuring databases are reliable, secure, available and continuously optimized Big Data: Harnessing the transformative power of data on a massive scale Advanced Analytics: Mining data for insights & business transformation using data science
  • 7. AGENDA Introduction to Ansible Installation Playbooks Roles Templates Modules and custom modules Live demo – automatic Oracle patching (c) The Pythian Group Inc., 2017 7
  • 9. ansible engine • Open - source automation engine • Owned by RedHat ▪ Available for Red Hat Enterprise Linux, CentOS, Debian, Ubuntu, OEL … ▪ Windows support - only as a target machine • Written in Python • Agentless architecture • Git repository: https://github.com/ansible/ansible (c) The Pythian Group Inc., 2017 9
  • 10. ansible consist of … architecture • Inventory configuration • Modules • Playbooks • Roles (c) The Pythian Group Inc., 2017 10
  • 11. ansible architecture architecture • Two types of servers: controlling machines and nodes (targets) • Targets are managed by a controlling machine over SSH, WINRM (c) The Pythian Group Inc., 2017 11 control machine web servers database servers orchestrates (SSH, WINRM) no agents
  • 12. ansible installation • RPMs for Enterprise Linux 6, 7 are available from yum via EPEL http://fedoraproject.org/wiki/EPEL • Add EPEL on OEL7, RHEL7 or CentOS wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install epel-release-latest-7.noarch.rpm • Install Ansible yum install ansible (c) The Pythian Group Inc., 2017 12
  • 13. ansible installation OSX • Installation is done via pip • Install Xcode • Install pip and ansible sudo easy_install pip pip install ansible • For more information see: http://docs.ansible.com/ansible/intro_installation.html#latest-release-via-yum (c) The Pythian Group Inc., 2017 13
  • 14. ansible configuration files • Ansible configuration file: /etc/ansible/ansible.cfg • Define the hosts in a ‘hosts’ file, by default in /etc/ansible/hosts List all defined hosts: ansible all --list-hosts (c) The Pythian Group Inc., 2017 14 ... db8.example.org [webservers] app1.example.org app2.example.org [dbservers] db1.example.org ansible_host=... ansible_port=... ansible_ssh_private_key_file=... ansible_user=... db2.example.org
  • 15. ansible – windows support • Control machine requires pywinrm, a Python module for the Windows Remote Management (WinRM) (c) The Pythian Group Inc., 2017 15 Option Local Accounts Active Directory Accounts Credential Delegation Basic Yes No No Certificate Yes No No Kerberos No Yes Yes NTLM Yes Yes No CredSSP Yes Yes Yes
  • 16. ansible – windows support example configuration with kerberos • Kerberos configuration file /etc/krb5.conf (c) The Pythian Group Inc., 2017 16 ... [realms] WINGROUP.AD = { kdc = win-hrms-srv.WINGROUP.AD admin_server = win-hrms-srv.WINGROUP.AD default_domain = WINGROUP.AD } [domain_realm] .wingroup.ad = WINGROUP.AD wingroup.ad = WINGROUP.AD
  • 17. ansible – windows support ‘hosts’ file • Inventory/hosts (c) The Pythian Group Inc., 2017 17 ... [windows] win-hrms-srv.wingroup.ad [windows:vars] ansible_user = iarsov@WINGROUP.AD ansible_password = ******** ansible_connection = winrm ansible_port = 5986 ansible_winrm_server_cert_validation =ignore
  • 19. modules • Library plugins , always are executed on target machine • Ansible comes with large number of modules • Each module supports specific number of arguments (c) The Pythian Group Inc., 2017 19 ansible vm12r1 -m copy -a "src=/tmp/file.txt dest=/tmp/file.txt" SSH password: vm12r1 | SUCCESS => { "changed": true, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "dest": "/tmp/file.txt", "gid": 500, "group": "dba", ... } target module argumentargument
  • 20. custom modules developing modules • First check if similar module already exist • http://docs.ansible.com/ansible/latest/list_of_all_modules.html • GitHub (all module updates): https://github.com/ansible/ansible/labels/module • Not enough documentation regarding development • If you want additional checks on control machine use action_plugins (c) The Pythian Group Inc., 2017 20
  • 21. • Test module date.py code (c) The Pythian Group Inc., 2017 21 developing modules our first custom module #!/usr/bin/python import datetime import json date = str(datetime.datetime.now()) print(json.dumps({ "time" : date })) ansible ansible-demo --module-path=/home/ansible -m date ansible-demo | SUCCESS => { "changed": false, "time": "2017-08-31 14:48:10.978621” }
  • 22. ansible execution • The modules are copied and executed on target machines • Destination can be controlled with local_tmp in ansible.cfg Execution steps: 1. Create local temporary directory: $HOME/.ansible/tmp/ansible-tmp-xxx/ansiballz_cache 2. Copy module 3. Execute module 4. Return result in JSON format 5. Clear (remove) ansible-tmp-xxx/ansiballz_cache (c) The Pythian Group Inc., 2017 22
  • 23. ad-hoc task execution • The “ping” example • Ad-hoc tasks are run with ansible command • Ansible uses SSH authentication, you need to specify an user (c) The Pythian Group Inc., 2017 23 ansible vm12r1 -m ping -u root -k SSH password: vm12r1 | SUCCESS => { "changed": false, "ping": "pong" } target module user
  • 25. YAML basic rules YAML Ain't Markup Language • Human readable data structure • Less complex than JSON or XML • YAML is case sensitive • Does not allow tabs. You must use spaces. YAML XML (c) The Pythian Group Inc., 2017 25 db_list: - oracle_owner: oracle oracle_home: /u01/app... sid: orcl ... <db_list> <oracle_owner>oracle</oracle_owner> <oracle_home>/u01/app...</oracle_home> <sid>orcl</sid> ... </db_list>
  • 26. • Organize the “play” tasks • Playbook’s language is YAML • Each play contains set of tasks • Tasks are executed one at a time in order against all matched targets • Command ansible-playbook Play example: playbook.yml - hosts: dbservers user: root tasks: - name: ping hostname ping: - name: create directory file: path=/home/ansible/bgoug2017 state=directory playbooks (c) The Pythian Group Inc., 2017 26
  • 27. - hosts: dbservers user: root tasks: - name: ping hostname ping: - hosts: webservers user: root tasks: - name: create directory file: path=/home/ansible/bgoug2017 state=directory • Playbooks can contain multiple plays • Split tasks performed per different host groups playbooks (c) The Pythian Group Inc., 2017 27
  • 28. Variables file definition (var_def.yml) Playbook file definition - hosts: “{{ hostname }}“ user: “{{ user }}“ vars_files: - var_def.yml tasks: - name: create directory file: path={{ dir_path }} state=directory using variables variables (c) The Pythian Group Inc., 2017 28 hostname: ansible-demo dir_path: /home/ansible/bgoug2017 user: root • Variables are used using the Jinja2 templating system • You can also use variables in Templates • Variables are referenced with double curly brackets: {{ variable_name }}
  • 29. variables (c) The Pythian Group Inc., 2017 29 - hosts: “{{ hostname }}“ user: “{{ user }}“ tasks: - name: create directory file: path={{ dir_path }} state=directory vars: - hostname: ansible-demo user: root dir_path: /home/ansible/bgoug2017 • Variables can be defined within the playbook
  • 30. variables (c) The Pythian Group Inc., 2017 30 ansible-playbook demo2.yml -k --extra-vars="dir_path=/home/ansible/bgoug2017 user=root hostname=ansible-demo“ SSH password: PLAY [ansible-demo] *************************************************************************************** ok: [ansible-demo] TASK [create directory] *************************************************************************************** ok: [ansible-demo] PLAY RECAP *************************************************************************************** ansible-demo : ok=2 changed=0 unreachable=0 failed=0 • Variables can also be defined from command line
  • 31. ansible – windows support • Playbook wintest.yml (c) The Pythian Group Inc., 2017 31 --- - name: Windows demo hosts: windows tasks: - name: Create directory "D:ansiblebgoug2017" win_command: Powershell.exe "mkdir D:ansiblebgoug2017"
  • 33. roles how to organize the tasks? • Represent “automation” within ansible • You can define variables for all roles or per role • Not complex at all. No hidden magic. • Supports automatic load of main.yml file for tasks, handlers, variables, meta definitions and role “default” variables (c) The Pythian Group Inc., 2017 33
  • 34. site.yml dbswinstall.yml roles/ dbinstall/ files/ templates/ tasks/ main.yml handlers/ vars/ main.yml defaults/ ... *main.yml files are automatically loaded dbswinstall.yml snippet: --- - hosts: chicago user: oracle roles: - hostconfig - dbinstall - dbmonitor dbservers role project structure role playbook variable definitions tasks definitions (c) The Pythian Group Inc., 2017 34
  • 35. role dependencies • Role dependencies are defined in meta/main.yml file • Allows you to reference other roles before running a role (c) The Pythian Group Inc., 2017 35 --- dependencies: - { role: common } ... dbswinstall.yml roles/ common/ dbinstall/ files/ meta/ main.yml tasks/ ...
  • 36. Templates Introduction to ansible templating • Sometimes pre-defined configuration files are needed for installation • An example is the Oracle dbca configuration file • Templating allows ansible variables substitution within templates (c) The Pythian Group Inc., 2017 36
  • 37. Templates ... #------------------------------------------------------------------------------- # Specify the hostname of the system as set during the install. It can be used # to force the installation to use an alternative hostname rather than using the # first hostname found on the system. (e.g., for systems with multiple hostnames # and network interfaces) #------------------------------------------------------------------------------- ORACLE_HOSTNAME={{ ansible_hostname }} #------------------------------------------------------------------------------- # Specify the Unix group to be set for the inventory directory. #------------------------------------------------------------------------------- UNIX_GROUP_NAME={{ oracle_group }} ... (c) The Pythian Group Inc., 2017 37
  • 38. Templates • Source template file is copied to target destination and variables are substituted (c) The Pythian Group Inc., 2017 38 - name: create 11g installer response file template: src: db_11204.rsp.j2 dest: /tmp/db_11204.rsp owner: "{{ oracle_user }}" group: "{{ oracle_group }}" mode: 0640
  • 39. Demo Example: Oracle 11.2.0.4 software installation
  • 40. oracle database install installation of oracle 11.2.0.4 software oracle_base: "/oracle/app/oracle" oracle_home: "/oracle/app/oracle/product/11.2.0.4/db1" oracle_user: oracle oracle_group: dba swlib_path: "/oracle/install" db_edition: EE DBComponents: "oracle.rdbms.partitioning:11.2.0.4.0" (c) The Pythian Group Inc., 2017 40
  • 41. oracle database install installation of oracle 11.2.0.4 software (c) The Pythian Group Inc., 2017 41 - name: create oracle base directory file: path: "{{ oracle_base }}" state: directory owner: "{{ oracle_user }}" group: "{{ oracle_group }}" mode: 0775
  • 42. oracle database install installation of oracle 11.2.0.4 software (c) The Pythian Group Inc., 2017 42 - name: create 11g installer response file template: src: db_11204.rsp.j2 dest: /tmp/db_11204.rsp owner: "{{ oracle_user }}" group: "{{ oracle_group }}" mode: 0640
  • 43. oracle database install installation of oracle 11.2.0.4 software - name: install base software command: "{{ swlib_path }}/11204/installer/database/runInstaller -silent -ignorePrereq -ignoreSysPrereqs -waitforcompletion -responseFile /tmp/db_11204.rsp" register: install_db_software args: creates: "{{ oracle_home }}" failed_when: "'skipped' not in install_db_software.stdout and 'Successfully Setup Software.' not in install_db_software.stdout“ (c) The Pythian Group Inc., 2017 43
  • 44. oracle database install installation of oracle 11.2.0.4 software - name: run root-script orainstRoot.sh command: "{{ oracle_base }}/../oraInventory/orainstRoot.sh" when: "'skipped' not in install_db_software.stdout" become: true become_user: root become_method: sudo (c) The Pythian Group Inc., 2017 44
  • 45. oracle database install installation of oracle 11.2.0.4 software - name: run root-script root.sh from ORACLE_HOME command: "{{ oracle_home }}/root.sh" when: "'skipped' not in install_db_software.stdout" become: true become_user: root become_method: sudo - name: clean up installer response file file: path: /tmp/db_11204.rsp state: absent (c) The Pythian Group Inc., 2017 45
  • 46. orapatch custom module • Can be used to apply PSU on 10g, 11g and 12c • Written in Python (~1500 lines of code) In summary: • You need to specify: • oracle home path, PSU or DBBP patch ID, whether to patch only the oracle home binaries, all databases or specific set of databases • It will automatically: • stop OH services, apply PSU or DBBP according specified settings, start back the services as before the patching (c) The Pythian Group Inc., 2017 46
  • 47. always executed orapatch workflow (c) The Pythian Group Inc., 2017 47 Check OPatch minimum version Check conflicts against OH Patch OH Patch DB Patch OH OJVM Patch DB OJVM End logger session Fetch orapatch logfile Start logger session Push SQL scripts
  • 48. - name: Patch oracle software serial: 1 vars_prompt: - name: "root_password" prompt: "Enter root password (press enter to skip)" private: yes - name: "root_password_confirm" prompt: "Enter root password again (press enter to skip)" private: yes pre_tasks: - assert: that: root_password == root_password_confirm msg: "Root password missmatch." hosts: database user: oracle roles: - orapatch (c) The Pythian Group Inc., 2017 48
  • 49. orapatch vars/main.yml db_list: - oracle_owner: oracle oracle_home_path: /oracle/app/oracle/product/12.2.0.1/db1 patch_directory: "12.1.0.2/psu" run_only_checks: False patch: True patch_id: 26129945 patch_only_oh: True patch_ojvm: False patch_db_all: False patch_db_list: "orcl" patch specific databases patch all databases for specified OH apply OJVM PSU patch only oracle specified oracle home run only prerequisite checks oracle home to patch directory where patch binaries are located (c) The Pythian Group Inc., 2017 49
  • 50. patch_dict: 26129945: patch_proactive_bp_id: 26129945 patch_gi_id: patch_db_id: 25983138 patch_ocw_id: 26187629 patch_ojvm_id: patch_acfs_id: patch_dbwlm_id: patch_dir: 26129945 file: p26129945_121020_Linux-x86-64.zip only_oh: False desc: "DATABASE PROACTIVE BUNDLE PATCH 12.2.0.1.170620” 26550339: patch_proactive_bp_id: patch_gi_id: 26610308 ... (c) The Pythian Group Inc., 2017 50
  • 51. (c) The Pythian Group Inc., 2017 51
  • 52. (c) The Pythian Group Inc., 2017 52
  • 53. (c) The Pythian Group Inc., 2017 53
  • 54. (c) The Pythian Group Inc., 2017 54
  • 55. (c) The Pythian Group Inc., 2017 55
  • 56. (c) The Pythian Group Inc., 2017 56
  • 57. ansible blog posts • AUTOMATINC ORACLE RMAN BACKUP CONFIGURATION ON LINUX WITH ANSIBLE https://www.pythian.com/blog/automating-oracle-rman-backup-configuration-linux-ansible • CREATING ANSIBLE CUSTOM MODULE FOR AWR REPORT GENERATION https://www.pythian.com/blog/creating-ansible-custom-module-for-awr-reports-generation • SIMPLE STEPS TO PERFORM OPATCH MAINTENANCE WITH ANSIBLE https://www.pythian.com/blog/opatch-maintenance-with-ansible • ANSIBLE AND AWS AUTOMATION https://www.pythian.com/blog/ansible-and-aws-automation More at: https://www.pythian.com/blog/?s=ansible (c) The Pythian Group Inc., 2017 57
  • 58. Thank you. Questions? (c) The Pythian Group Inc., 2017 58