RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING...

14
RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

Transcript of RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING...

Page 1: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT

Aleš Dujíček, Red HatPyCon Israel2. - 3. 5. 2016

Page 2: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

2

SPACEWALKSystem management tool

VAGRANTVM management tool

ANSIBLEConfiguration

management tool

INTRODUCTION

Page 3: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

3

VAGRANT

● VM management tool● Quick and easy to start, use and destroy VMs

● vagrant up● vagrant ssh● vagrant destroy

● Providers: libvirt, virtualbox, docker, …● Provisioning: shell, ansible, chef, puppet, …

Page 4: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

4

VAGRANT BOXES

● https://atlas.hashicorp.com/boxes/search● box.img

● Libvirt image● Vagrantfile

● default configuration● metadata.json

● tar czf x.box metadata.json Vagrantfile box.img

{ "provider" : "libvirt", "format" : "qcow2", "virtual_size" : 6 }

Page 5: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

5

VAGRANTFILE

● Ruby script● Configuration of VM

Vagrant.configure(2) do |config|

config.vm.box = "Centos"

config.vm.provision "shell", inline: <<-SHELL yum update -y yum install -y httpd SHELL

end

Page 6: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

6

ANSIBLE

● Configuration management tool● Needs only SSH and Python● Ad-hoc command

● $ ansible localhost -m ping● Playbooks and inventories● Lot of modules

● $ ansible-doc --list

Page 7: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

7

ANSIBLE PLAYBOOKS

● YAML formatted files● Describes hosts, variables, roles, and tasks ● Run

$ ansible-playbook playbook.yml

---- hosts: all tasks:

- name: Install git yum: git state: present

- name: ……

Page 8: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

8

ANSIBLE INVENTORY

● INI formatted file● Describes groups of hosts

$ ansible dbservers -i inventory -m ping

s1.example.com

[webservers]www1.example.comwww2.example.com

[dbservers]db1.example.com

Page 9: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

9

VAGRANT WITH ANSIBLE

● Vagrantfile + playbook

Vagrant.configure(2) do |config|

config.vm.box = "Fedora23"

config.vm.provision "ansible" do |ansible| ansible.playbook = "playbook.yml" end

end

Page 10: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

10

Page 11: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

11

Page 12: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

12

Page 13: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

13

Page 14: RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE … · RUNNING UPSTREAM SPACEWALK TESTS USING ANSIBLE AND VAGRANT Aleš Dujíček, Red Hat PyCon Israel 2. - 3. 5. 2016

THANK YOU

plus.google.com/+RedHat

youtube.com/user/RedHatVideos

facebook.com/redhatinc

twitter.com/RedHatNewslinkedin.com/company/red-hat