Configuration using Ansible
Configure Apache Web Server(http)
create file:
#vim http.yml
& write the code
---
- hosts: apache
remote_user: root
vars:
http_port: 80
max_client: 300
tasks:
- name: installing apache web server(httpd)
yum:
name: httpd
state: latest
- hosts: apache
remote_user: root
vars:
http_port: 80
max_client: 300
tasks:
- name: installing apache web server(httpd)
yum:
name: httpd
state: latest
- name: starting apache web server service
service:
name: httpd
state: started
enabled: yes
- name: disable selinux
lineinfile: dest=/etc/selinux/config
regexp='^SELINUX='
line='SELINUX=disabled'
state=present
- name: disable iptables
lineinfile: dest=/etc/rc.local
regexp=''
line='iptables -F'
state=present
service:
name: httpd
state: started
enabled: yes
- name: disable selinux
lineinfile: dest=/etc/selinux/config
regexp='^SELINUX='
line='SELINUX=disabled'
state=present
- name: disable iptables
lineinfile: dest=/etc/rc.local
regexp=''
line='iptables -F'
state=present
######################
Deploy Web Application
---
- hosts: apache
remote_user: root
vars:
http_port: 80
max_client: 300
tasks:
- name: copying application files
copy:
src: /var/www/cloud/adhoc.tar
dest: /var/www/
- unarchive:
src: /var/www/adhoc.tar
dest: /var/www/
remote_src: True
- name: configure
lineinfile: dest=/etc/sudoers
regexp=''
line='apache ALL=(ALL) NOPASSWD:ALL'
state=present
- name: starting apache web server service
service:
name: httpd
state: restarted
enabled: yes
######################################
Configure SSL/TLS
---
- hosts: apache
remote_user: root
vars:
http_port: 80
max_client: 300
tasks:
- name: installing modssl server
yum:
name: mod_ssl
state: latest
- name: iptables flush
command: iptables -F
- name: restart the apache service
service:
name: httpd
state: restarted
enabled: yes
- hosts: apache
remote_user: root
vars:
http_port: 80
max_client: 300
tasks:
- name: installing modssl server
yum:
name: mod_ssl
state: latest
- name: iptables flush
command: iptables -F
- name: restart the apache service
service:
name: httpd
state: restarted
enabled: yes
Comments
Post a Comment