Skip to main content

Posts

Showing posts from June, 2018

HOW TO CHANGE A LINE IN A FILE AND RESTART A SERVICE

HOW TO CHANGE A LINE IN A FILE IN AND RESTART A SERVICE --- - name: modify el /etc/ssh/sshd_config to change  root login   hosts: LINUX_SERVERS   tasks:     - name:  /etc/ssh/sshd_config, line PermitRootLogin       lineinfile:         path: /etc/ssh/sshd_config         regexp: 'PermitRootLogin'         line: 'PermitRootLogin no'     - name: restart sshd daemon       service: name=sshd state=restarted     - name: status sshd daemon       service: name=sshd state=restarted

HOW TO UPDATE A PACKAGE LIST WITH ANSIBLE

HOW TO UPDATE A PACKAGE LIST WITH ANSIBLE  --- - name: Update package list   hosts: test1 test2 test3 test4 test5   tasks:     - name: Update dhcp package       yum:         name: dhcp         state: latest         update_only: yes     - name: Update dhcp dhcp-common       yum:         name: dhcp-common         state: latest         update_only: yes     - name: Update dhcp dhcp-libs       yum:         name: dhcp-libs         state: latest         update_only: yes     - name: Update dhcp dhclient       yum:         name: dhclient         state: latest         update_only: yes

HOW TO SET PASSWORD WITH ANSIBLE MULTIPLE HOST

HOW TO SET PASSWORD WITH ANSIBLE  --- - name: Set Password   hosts: test1 test2 test2   become: yes   ignore_errors: yes   tasks:       - name: Change root password         user:           name: root           password: $dff2878927319283198439843hjsddhdkjch823787431213413dwfwfvwgwwq.           update_password: always (In password: Encrypted Password  )