April 2018
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Categories

April 2018
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Creating role in ansible

Creating a basic role for displaying message of the day

[root@workstation ~]# vim /etc/ansible/roles/motd/main.yml — – name: use motd role playbook hosts: all

roles: – motd

[root@workstation ~]# vim /etc/ansible/roles/motd/defaults/main.yml — system_owner: rmohan [root@workstation ~]# vim /etc/ansible/roles/motd/tasks/main.yml — – name: deliver motd file template: src: templates/motd.j2 dest: /etc/motd owner: root group: root mode: 777 [root@workstation […]

HANDLERS & register in ansible

HANDLERS & register in ansible

[root@workstation ~]# vim register.yaml — – name: checking the register module functionality hosts: localhost tasks: – name: command: ps register: output – debug: msg=”{{ output.stdout }}” ==================================================== [root@workstation ~]# ansible-playbook –syntax-check register.yaml

playbook: register.yaml

[root@workstation ~]# ansible-playbook register.yaml

PLAY [checking the register module functionality] ******************************

TASK [setup] ******************************************************************* ok: [localhost]

[…]

Tags in ansible

Tags in ansible

[root@workstation ~]# vim tags.yaml — – name: installing postfix and stopping from starting service hosts: localhost tasks: – name: installing postfix package yum: name=postfix state=latest tags: packageonly – name: starting service service: name=postfix state=started [root@workstation ~]# ansible-playbook –syntax-check tags.yaml

playbook: tags.yaml [root@workstation ~]# ansible-playbook -C tags.yaml

PLAY [installing postfix and stopping from […]

Creating role in ansible

Creating role in ansible

Creating a basic role for displaying message of the day

[root@workstation ~]# vim /etc/ansible/roles/motd/main.yml — – name: use motd role playbook hosts: all

roles: – motd

[root@workstation ~]# vim /etc/ansible/roles/motd/defaults/main.yml — system_owner: rmohan [root@workstation ~]# vim /etc/ansible/roles/motd/tasks/main.yml — – name: deliver motd file template: src: templates/motd.j2 dest: /etc/motd owner: root group: […]

Including variables in Ansible

Including variables in Ansible

===================================== [root@ansible1 ~]$ mkdir nginx ===================================== [root@ansible1 ~]$ cd nginx [root@ansible1 nginx]$ mkdir tasks vars

===================================== [root@ansible1 nginx]$ touch tasks/environment.yml ===================================== [root@ansible1 nginx]$ touch vars/variables.yml ===================================== [root@ansible1 ~]$ tree nginx nginx |– nginx.yml |– tasks | `– environment.yml `– vars `– variables.yml ===================================== [root@ansible1 nginx]$ vim tasks/environment.yml — – name: install […]

Continuous Delivery Using Docker And Ansible

Continuous Delivery Using Docker And Ansible

Continuous Delivery Release Often Release Faster Great Reliable

Continuous Delivery workflow/pipeline

With which we can Test,Build,Release,& Deploy a simple application.

Application will be of any technology ex:python based.

The work flow will be Based upon using docker & docker-compose which is a emerging technology. With a goal to release […]

how to use sysctl with ansible

[root@localhost ~]# sysctl -a |grep vm.swappiness vm.swappiness = 30

[root@localhost ~]# ansible-galaxy init sysctl – sysctl was created successfully

[root@localhost ~]# ansible-doc sysctl

[root@localhost ~]# vim test.yml — – hosts: localhost roles: – sysctl vars: sysctl_settings: – name: vm.swappiness value: 90

[root@localhost ~]# vim sysctl/tasks/main.yml — # tasks file for sysctl – name: sysctl settings […]

AWS with Ansible and Terraform

rmohan@root:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.4 LTS Release: 16.04 Codename: xenial rmohan@root:~$ python –version Python 2.7.12

rmohan@root:~$ sudo apt-get install python-pip Reading package lists… Done Building dependency tree Reading state information… Done python-pip is already the newest version (8.1.1-2ubuntu0.4). The following packages were automatically installed and are […]

Install latest ansible version

[root@ocp ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.4 (Maipo)

[root@ocp ~]# yum install python-pip

[root@ocp ~]# pip2.7 install ansible

[root@ocp ~]# ansible –version ansible 2.5.0 config file = None configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible python version = 2.7.5 (default, May […]

limits.conf with ansible

[root@localhost ~]# ansible-galaxy init limits.conf – limits.conf was created successfully

[root@localhost ~]# ansible-doc pam_limits

[root@localhost ~]# vim limits.conf/tasks/main.yml — # tasks file for limits.conf – pam_limits: domain: “{{ item.domain }}” limit_type: “{{ item.limit_type }}” limit_item: “{{ item.limit_item }}” value: “{{ item.value }}” with_items: “{{ limits_conf_settings }}”

[root@localhost ~]# vim limits_conf.yml — – hosts: all roles: […]