SlideShare a Scribd company logo
1 of 23
Infrastructure as code (IaC) means to manage your IT
infrastructure using configuration files.
[defaults]
nocows = 1
command_warnings = True
strategy = free
become_method = sudo
[ssh_connection]
pipelining = True
scp_if_ssh = False
$ ansible-config –help
Usage: ansible-config [dump|list|view] [--help] [options] [ansible.cfg]
---
- name: Project Setup
hosts: all
gather_facts: True
vars:
project: "{{ lookup('env’,proj_name’) }}"
php_version: 7.3
fpm: "yes"
application_server_listen_on: "socket"
socket_name: "{{ project }}"
nginx_root_path: {{ project }}/public_html"
nginx_dir: "/etc/nginx"
nginx_domain: "{{ project }}"
become: yes
become_user: root
become_method: sudo
roles:
- ansible-common
- create-user
- php-fpm
- nginx
- mysql
[local]
local_sudo ansible_connection=local ansible_become=true become_method=sudo
local_user ansible_connection=local ansible_become=false
[targets]
web1 ansible_host=x.x.x.x ansible_user=webapp1
web2 ansible_host=x.x.x.x ansible_user=webapp1
web3 ansible_host=x.x.x.x ansible_ssh_private_key_file=~/.ssh/id_rsa
mysql1 ansible_host=x.x.x.x ansible_user=root
mysql2 ansible_host=x.x.x.x ansible_become=true
[web]
web1
web2
web3
[mysql]
mysql1
mysql2
---
- name: Configure vhost for application server
template:
src: appserver.conf.j2
dest: "{{nginx_dir}}/sites-available/{{ nginx_domain }}.conf"
notify:
- nginx restart
when: nginx_setup_mode == "appserver"
- name: Configure vhost for static content
template:
src: frontend.conf.j2
dest: "{{nginx_dir}}/sites-available/{{ nginx_domain }}.conf"
notify:
- nginx restart
when: nginx_setup_mode == "frontend"
$ ansible-galaxy install nginx
$ ansible-galaxy init my-role
myrole/
├── README.md
├── defaults
│ └── main.yml
├── files
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
├── tests
│ ├── inventory
│ └── test.yml
└── vars
└── main.yml
$ molecule init role --role-name my-role
my-role/
├── README.md
├── defaults
│ └── main.yml
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── molecule
│ └── default
│ ├── Dockerfile.j2
│ ├── INSTALL.rst
│ ├── molecule.yml
│ ├── playbook.yml
│ └── tests
│ ├── __pycache__
│ │ └── test_default.cpython-36.pyc
│ └── test_default.py
├── tasks
│ └── main.yml
└── vars
└── main.yml
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_nginx_is_installed(host):
ngx = host.package("nginx")
assert ngx.is_installed
def test_nginx_running_and_enabled(host):
ngx = host.service("nginx")
assert ngx.is_running
assert ngx.is_enabled
def test_endpoint(host):
command = """curl -I http://localhost/"""
cmd = host.run(command)
assert '200 OK' in cmd.stdout
--> Test matrix
└── default
├── lint
├── dependency
├── cleanup
├── destroy
├── syntax
├── create
├── prepare
├── converge
├── idempotence
├── side_effect
├── verify
├── cleanup
└── destroy
$ molecule lint
$ molecule create
$ molecule converge
$ molecule verify
$ molecule test
Developers’ mDay 2019. - Rastko Vasiljević, SuperAdmins – Infrastructure as code na primeru Ansible-a

More Related Content

What's hot

Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Brian Schott
 
Rubyslava + PyVo #48
Rubyslava + PyVo #48Rubyslava + PyVo #48
Rubyslava + PyVo #48Jozef Képesi
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartHenry Stamerjohann
 
Getting Started with Couchbase Ruby
Getting Started with Couchbase RubyGetting Started with Couchbase Ruby
Getting Started with Couchbase RubySergey Avseyev
 
Express Presentation
Express PresentationExpress Presentation
Express Presentationaaronheckmann
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slidesAaron Carey
 
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud EnvironmentsUsing Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environmentsahamilton55
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansiblebcoca
 
Creating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesCreating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesBram Vogelaar
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationKumar Y
 
Development of Ansible modules
Development of Ansible modulesDevelopment of Ansible modules
Development of Ansible modulesjtyr
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabricandymccurdy
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0bcoca
 
Puppet and the HashiCorp Suite
Puppet and the HashiCorp SuitePuppet and the HashiCorp Suite
Puppet and the HashiCorp SuiteBram Vogelaar
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with TerraformMario IC
 
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Big Data Spain
 

What's hot (20)

Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2
 
Rubyslava + PyVo #48
Rubyslava + PyVo #48Rubyslava + PyVo #48
Rubyslava + PyVo #48
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / Quickstart
 
ansible why ?
ansible why ?ansible why ?
ansible why ?
 
Getting Started with Couchbase Ruby
Getting Started with Couchbase RubyGetting Started with Couchbase Ruby
Getting Started with Couchbase Ruby
 
Express Presentation
Express PresentationExpress Presentation
Express Presentation
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slides
 
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud EnvironmentsUsing Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environments
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansible
 
Creating Reusable Puppet Profiles
Creating Reusable Puppet ProfilesCreating Reusable Puppet Profiles
Creating Reusable Puppet Profiles
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Development of Ansible modules
Development of Ansible modulesDevelopment of Ansible modules
Development of Ansible modules
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
 
Puppet and the HashiCorp Suite
Puppet and the HashiCorp SuitePuppet and the HashiCorp Suite
Puppet and the HashiCorp Suite
 
Automating with Ansible
Automating with AnsibleAutomating with Ansible
Automating with Ansible
 
nginx mod PSGI
nginx mod PSGInginx mod PSGI
nginx mod PSGI
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
 
RingoJS
RingoJSRingoJS
RingoJS
 
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
 

Similar to Developers’ mDay 2019. - Rastko Vasiljević, SuperAdmins – Infrastructure as code na primeru Ansible-a

Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestrationPaolo Tonin
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOpsОмские ИТ-субботники
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with ociDonghuKIM2
 
Deploying Django with Ansible
Deploying Django with AnsibleDeploying Django with Ansible
Deploying Django with Ansibleandrewmirskynet
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansibleahamilton55
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
Terraform in deployment pipeline
Terraform in deployment pipelineTerraform in deployment pipeline
Terraform in deployment pipelineAnton Babenko
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricksbcoca
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as codedaisuke awaji
 
PM : code faster
PM : code fasterPM : code faster
PM : code fasterPHPPRO
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and ContainersRodolfo Carvalho
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)LumoSpark
 
ARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CIARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CICosmin Poieana
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with PuppetKris Buytaert
 

Similar to Developers’ mDay 2019. - Rastko Vasiljević, SuperAdmins – Infrastructure as code na primeru Ansible-a (20)

Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
 
Ansible with oci
Ansible with ociAnsible with oci
Ansible with oci
 
Deploying Django with Ansible
Deploying Django with AnsibleDeploying Django with Ansible
Deploying Django with Ansible
 
Getting Started with Ansible
Getting Started with AnsibleGetting Started with Ansible
Getting Started with Ansible
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Terraform in deployment pipeline
Terraform in deployment pipelineTerraform in deployment pipeline
Terraform in deployment pipeline
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Bosh 2.0
Bosh 2.0Bosh 2.0
Bosh 2.0
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as code
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
 
ARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CIARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CI
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
 
Write php deploy everywhere tek11
Write php deploy everywhere   tek11Write php deploy everywhere   tek11
Write php deploy everywhere tek11
 

More from mCloud

Developers’ mDay 2021: Robert Juhas, SimpleTask – Should I run my own blockc...
Developers’ mDay 2021: Robert Juhas, SimpleTask –  Should I run my own blockc...Developers’ mDay 2021: Robert Juhas, SimpleTask –  Should I run my own blockc...
Developers’ mDay 2021: Robert Juhas, SimpleTask – Should I run my own blockc...mCloud
 
Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...
Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...
Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...mCloud
 
Developers’ mDay 2021: Goran Kunjadić, Cyber security, cryptography and DPO e...
Developers’ mDay 2021: Goran Kunjadić, Cyber security, cryptography and DPO e...Developers’ mDay 2021: Goran Kunjadić, Cyber security, cryptography and DPO e...
Developers’ mDay 2021: Goran Kunjadić, Cyber security, cryptography and DPO e...mCloud
 
Developers’ mDay 2021: Igor Spasić, Oblac – Jodd, jedna open-source priča
Developers’ mDay 2021: Igor Spasić, Oblac – Jodd, jedna open-source pričaDevelopers’ mDay 2021: Igor Spasić, Oblac – Jodd, jedna open-source priča
Developers’ mDay 2021: Igor Spasić, Oblac – Jodd, jedna open-source pričamCloud
 
Developers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel Awesome
Developers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel AwesomeDevelopers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel Awesome
Developers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel AwesomemCloud
 
Developers’ mDay 2021: Nikola Krgović, Twin Star Systems – CentOS i šta dalje
Developers’ mDay 2021: Nikola Krgović, Twin Star Systems – CentOS i šta daljeDevelopers’ mDay 2021: Nikola Krgović, Twin Star Systems – CentOS i šta dalje
Developers’ mDay 2021: Nikola Krgović, Twin Star Systems – CentOS i šta daljemCloud
 
Developers’ mDay 2021: Nebojša Kamber, Infostud – SQL vs noSQL
Developers’ mDay 2021: Nebojša Kamber, Infostud – SQL vs noSQLDevelopers’ mDay 2021: Nebojša Kamber, Infostud – SQL vs noSQL
Developers’ mDay 2021: Nebojša Kamber, Infostud – SQL vs noSQLmCloud
 
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sadDevelopers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sadmCloud
 
Developers’ mDay 2021: Jelena Opačić, mCloud – Dobrodošlica
Developers’ mDay 2021: Jelena Opačić, mCloud – DobrodošlicaDevelopers’ mDay 2021: Jelena Opačić, mCloud – Dobrodošlica
Developers’ mDay 2021: Jelena Opačić, mCloud – DobrodošlicamCloud
 
Developers’ mDay 2019. - Zvonimir Gembec, Sysbee – Developers vs Sysadmins – ...
Developers’ mDay 2019. - Zvonimir Gembec, Sysbee – Developers vs Sysadmins – ...Developers’ mDay 2019. - Zvonimir Gembec, Sysbee – Developers vs Sysadmins – ...
Developers’ mDay 2019. - Zvonimir Gembec, Sysbee – Developers vs Sysadmins – ...mCloud
 
Developers’ mDay 2019. - Dijana Milutinović, RNIDS – Kako se kalio domen
Developers’ mDay 2019. -  Dijana Milutinović, RNIDS – Kako se kalio domenDevelopers’ mDay 2019. -  Dijana Milutinović, RNIDS – Kako se kalio domen
Developers’ mDay 2019. - Dijana Milutinović, RNIDS – Kako se kalio domenmCloud
 
Developers’ mDay 2019. - Bogdan Kecman, Oracle – MySQL 8.0 – why upgrade
Developers’ mDay 2019. - Bogdan Kecman, Oracle – MySQL 8.0 – why upgradeDevelopers’ mDay 2019. - Bogdan Kecman, Oracle – MySQL 8.0 – why upgrade
Developers’ mDay 2019. - Bogdan Kecman, Oracle – MySQL 8.0 – why upgrademCloud
 
Developers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivity
Developers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivityDevelopers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivity
Developers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivitymCloud
 
Developers’ mDay 2019. - Adrian Smijulj, Webiny – Server-side rendering u Ser...
Developers’ mDay 2019. - Adrian Smijulj, Webiny – Server-side rendering u Ser...Developers’ mDay 2019. - Adrian Smijulj, Webiny – Server-side rendering u Ser...
Developers’ mDay 2019. - Adrian Smijulj, Webiny – Server-side rendering u Ser...mCloud
 
Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...
Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...
Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...mCloud
 
Developers’ mDay 2019. - Dragutin Ćirković, mCloud – HTTP/3
Developers’ mDay 2019. - Dragutin Ćirković, mCloud – HTTP/3Developers’ mDay 2019. - Dragutin Ćirković, mCloud – HTTP/3
Developers’ mDay 2019. - Dragutin Ćirković, mCloud – HTTP/3mCloud
 
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux – Unified IoT Pl...
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux –  Unified IoT Pl...Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux –  Unified IoT Pl...
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux – Unified IoT Pl...mCloud
 
Developers’ mDay u Banjoj Luci - Jelena Opačić, mCloud – Dobrodošlica
Developers’ mDay u Banjoj Luci - Jelena Opačić, mCloud – DobrodošlicaDevelopers’ mDay u Banjoj Luci - Jelena Opačić, mCloud – Dobrodošlica
Developers’ mDay u Banjoj Luci - Jelena Opačić, mCloud – DobrodošlicamCloud
 
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...mCloud
 
Developers’ mDay u Banjoj Luci - Ivan Đukić, ECD, Blockchain & Cryptocurrency...
Developers’ mDay u Banjoj Luci - Ivan Đukić, ECD, Blockchain & Cryptocurrency...Developers’ mDay u Banjoj Luci - Ivan Đukić, ECD, Blockchain & Cryptocurrency...
Developers’ mDay u Banjoj Luci - Ivan Đukić, ECD, Blockchain & Cryptocurrency...mCloud
 

More from mCloud (20)

Developers’ mDay 2021: Robert Juhas, SimpleTask – Should I run my own blockc...
Developers’ mDay 2021: Robert Juhas, SimpleTask –  Should I run my own blockc...Developers’ mDay 2021: Robert Juhas, SimpleTask –  Should I run my own blockc...
Developers’ mDay 2021: Robert Juhas, SimpleTask – Should I run my own blockc...
 
Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...
Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...
Developers’ mDay 2021: Andrea Bjelogrlić, Sysbee – Tips, tricks and debugging...
 
Developers’ mDay 2021: Goran Kunjadić, Cyber security, cryptography and DPO e...
Developers’ mDay 2021: Goran Kunjadić, Cyber security, cryptography and DPO e...Developers’ mDay 2021: Goran Kunjadić, Cyber security, cryptography and DPO e...
Developers’ mDay 2021: Goran Kunjadić, Cyber security, cryptography and DPO e...
 
Developers’ mDay 2021: Igor Spasić, Oblac – Jodd, jedna open-source priča
Developers’ mDay 2021: Igor Spasić, Oblac – Jodd, jedna open-source pričaDevelopers’ mDay 2021: Igor Spasić, Oblac – Jodd, jedna open-source priča
Developers’ mDay 2021: Igor Spasić, Oblac – Jodd, jedna open-source priča
 
Developers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel Awesome
Developers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel AwesomeDevelopers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel Awesome
Developers’ mDay 2021: Mladen Janjetović, Laravel Srbija – Laravel Awesome
 
Developers’ mDay 2021: Nikola Krgović, Twin Star Systems – CentOS i šta dalje
Developers’ mDay 2021: Nikola Krgović, Twin Star Systems – CentOS i šta daljeDevelopers’ mDay 2021: Nikola Krgović, Twin Star Systems – CentOS i šta dalje
Developers’ mDay 2021: Nikola Krgović, Twin Star Systems – CentOS i šta dalje
 
Developers’ mDay 2021: Nebojša Kamber, Infostud – SQL vs noSQL
Developers’ mDay 2021: Nebojša Kamber, Infostud – SQL vs noSQLDevelopers’ mDay 2021: Nebojša Kamber, Infostud – SQL vs noSQL
Developers’ mDay 2021: Nebojša Kamber, Infostud – SQL vs noSQL
 
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sadDevelopers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
 
Developers’ mDay 2021: Jelena Opačić, mCloud – Dobrodošlica
Developers’ mDay 2021: Jelena Opačić, mCloud – DobrodošlicaDevelopers’ mDay 2021: Jelena Opačić, mCloud – Dobrodošlica
Developers’ mDay 2021: Jelena Opačić, mCloud – Dobrodošlica
 
Developers’ mDay 2019. - Zvonimir Gembec, Sysbee – Developers vs Sysadmins – ...
Developers’ mDay 2019. - Zvonimir Gembec, Sysbee – Developers vs Sysadmins – ...Developers’ mDay 2019. - Zvonimir Gembec, Sysbee – Developers vs Sysadmins – ...
Developers’ mDay 2019. - Zvonimir Gembec, Sysbee – Developers vs Sysadmins – ...
 
Developers’ mDay 2019. - Dijana Milutinović, RNIDS – Kako se kalio domen
Developers’ mDay 2019. -  Dijana Milutinović, RNIDS – Kako se kalio domenDevelopers’ mDay 2019. -  Dijana Milutinović, RNIDS – Kako se kalio domen
Developers’ mDay 2019. - Dijana Milutinović, RNIDS – Kako se kalio domen
 
Developers’ mDay 2019. - Bogdan Kecman, Oracle – MySQL 8.0 – why upgrade
Developers’ mDay 2019. - Bogdan Kecman, Oracle – MySQL 8.0 – why upgradeDevelopers’ mDay 2019. - Bogdan Kecman, Oracle – MySQL 8.0 – why upgrade
Developers’ mDay 2019. - Bogdan Kecman, Oracle – MySQL 8.0 – why upgrade
 
Developers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivity
Developers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivityDevelopers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivity
Developers’ mDay 2019. - Dejan Bosanac, Red Hat – Cloud scale IoT connectivity
 
Developers’ mDay 2019. - Adrian Smijulj, Webiny – Server-side rendering u Ser...
Developers’ mDay 2019. - Adrian Smijulj, Webiny – Server-side rendering u Ser...Developers’ mDay 2019. - Adrian Smijulj, Webiny – Server-side rendering u Ser...
Developers’ mDay 2019. - Adrian Smijulj, Webiny – Server-side rendering u Ser...
 
Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...
Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...
Developers’ mDay 2019. - Nikola Krgović, Twin Star Systems – Big Data for Dev...
 
Developers’ mDay 2019. - Dragutin Ćirković, mCloud – HTTP/3
Developers’ mDay 2019. - Dragutin Ćirković, mCloud – HTTP/3Developers’ mDay 2019. - Dragutin Ćirković, mCloud – HTTP/3
Developers’ mDay 2019. - Dragutin Ćirković, mCloud – HTTP/3
 
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux – Unified IoT Pl...
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux –  Unified IoT Pl...Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux –  Unified IoT Pl...
Developers’ mDay u Banjoj Luci - Janko Isidorović, Mainflux – Unified IoT Pl...
 
Developers’ mDay u Banjoj Luci - Jelena Opačić, mCloud – Dobrodošlica
Developers’ mDay u Banjoj Luci - Jelena Opačić, mCloud – DobrodošlicaDevelopers’ mDay u Banjoj Luci - Jelena Opačić, mCloud – Dobrodošlica
Developers’ mDay u Banjoj Luci - Jelena Opačić, mCloud – Dobrodošlica
 
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
 
Developers’ mDay u Banjoj Luci - Ivan Đukić, ECD, Blockchain & Cryptocurrency...
Developers’ mDay u Banjoj Luci - Ivan Đukić, ECD, Blockchain & Cryptocurrency...Developers’ mDay u Banjoj Luci - Ivan Đukić, ECD, Blockchain & Cryptocurrency...
Developers’ mDay u Banjoj Luci - Ivan Đukić, ECD, Blockchain & Cryptocurrency...
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Developers’ mDay 2019. - Rastko Vasiljević, SuperAdmins – Infrastructure as code na primeru Ansible-a

  • 1.
  • 2.
  • 3.
  • 4. Infrastructure as code (IaC) means to manage your IT infrastructure using configuration files.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. [defaults] nocows = 1 command_warnings = True strategy = free become_method = sudo [ssh_connection] pipelining = True scp_if_ssh = False $ ansible-config –help Usage: ansible-config [dump|list|view] [--help] [options] [ansible.cfg]
  • 12. --- - name: Project Setup hosts: all gather_facts: True vars: project: "{{ lookup('env’,proj_name’) }}" php_version: 7.3 fpm: "yes" application_server_listen_on: "socket" socket_name: "{{ project }}" nginx_root_path: {{ project }}/public_html" nginx_dir: "/etc/nginx" nginx_domain: "{{ project }}" become: yes become_user: root become_method: sudo roles: - ansible-common - create-user - php-fpm - nginx - mysql
  • 13. [local] local_sudo ansible_connection=local ansible_become=true become_method=sudo local_user ansible_connection=local ansible_become=false [targets] web1 ansible_host=x.x.x.x ansible_user=webapp1 web2 ansible_host=x.x.x.x ansible_user=webapp1 web3 ansible_host=x.x.x.x ansible_ssh_private_key_file=~/.ssh/id_rsa mysql1 ansible_host=x.x.x.x ansible_user=root mysql2 ansible_host=x.x.x.x ansible_become=true [web] web1 web2 web3 [mysql] mysql1 mysql2
  • 14. --- - name: Configure vhost for application server template: src: appserver.conf.j2 dest: "{{nginx_dir}}/sites-available/{{ nginx_domain }}.conf" notify: - nginx restart when: nginx_setup_mode == "appserver" - name: Configure vhost for static content template: src: frontend.conf.j2 dest: "{{nginx_dir}}/sites-available/{{ nginx_domain }}.conf" notify: - nginx restart when: nginx_setup_mode == "frontend"
  • 15. $ ansible-galaxy install nginx $ ansible-galaxy init my-role
  • 16. myrole/ ├── README.md ├── defaults │ └── main.yml ├── files ├── handlers │ └── main.yml ├── meta │ └── main.yml ├── tasks │ └── main.yml ├── templates ├── tests │ ├── inventory │ └── test.yml └── vars └── main.yml
  • 17.
  • 18.
  • 19.
  • 20. $ molecule init role --role-name my-role my-role/ ├── README.md ├── defaults │ └── main.yml ├── handlers │ └── main.yml ├── meta │ └── main.yml ├── molecule │ └── default │ ├── Dockerfile.j2 │ ├── INSTALL.rst │ ├── molecule.yml │ ├── playbook.yml │ └── tests │ ├── __pycache__ │ │ └── test_default.cpython-36.pyc │ └── test_default.py ├── tasks │ └── main.yml └── vars └── main.yml
  • 21. import os import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_nginx_is_installed(host): ngx = host.package("nginx") assert ngx.is_installed def test_nginx_running_and_enabled(host): ngx = host.service("nginx") assert ngx.is_running assert ngx.is_enabled def test_endpoint(host): command = """curl -I http://localhost/""" cmd = host.run(command) assert '200 OK' in cmd.stdout
  • 22. --> Test matrix └── default ├── lint ├── dependency ├── cleanup ├── destroy ├── syntax ├── create ├── prepare ├── converge ├── idempotence ├── side_effect ├── verify ├── cleanup └── destroy $ molecule lint $ molecule create $ molecule converge $ molecule verify $ molecule test