tp ansible
This commit is contained in:
		
							
								
								
									
										6
									
								
								sio1/sisr1/80-ansible/testansible/hosts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								sio1/sisr1/80-ansible/testansible/hosts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
[adm]
 | 
			
		||||
infra
 | 
			
		||||
 | 
			
		||||
[web]
 | 
			
		||||
web1
 | 
			
		||||
web2
 | 
			
		||||
							
								
								
									
										7
									
								
								sio1/sisr1/80-ansible/tpansible/hosts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								sio1/sisr1/80-ansible/tpansible/hosts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
[adm]
 | 
			
		||||
infra
 | 
			
		||||
 | 
			
		||||
[web]
 | 
			
		||||
web1
 | 
			
		||||
web2
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								sio1/sisr1/80-ansible/tpansible/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								sio1/sisr1/80-ansible/tpansible/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
<title>Bonjour</title>
 | 
			
		||||
							
								
								
									
										8568
									
								
								sio1/sisr1/80-ansible/tpansible/squid.conf.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8568
									
								
								sio1/sisr1/80-ansible/tpansible/squid.conf.j2
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										32
									
								
								sio1/sisr1/80-ansible/tpansible/squid.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								sio1/sisr1/80-ansible/tpansible/squid.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
---
 | 
			
		||||
- hosts: adm
 | 
			
		||||
  vars:
 | 
			
		||||
  - proxy_port: 8080
 | 
			
		||||
  - proxy_mem: 256
 | 
			
		||||
  - proxy_localnet: 192.168.0.0/24
 | 
			
		||||
  tasks:
 | 
			
		||||
    - name: Installation de proxy squid...
 | 
			
		||||
      apt:
 | 
			
		||||
        name: squid
 | 
			
		||||
        state: present
 | 
			
		||||
 | 
			
		||||
    - name: generation du fichier de configuration de squid...
 | 
			
		||||
      template:
 | 
			
		||||
        src: squid.conf.j2
 | 
			
		||||
        dest: /etc/squid/squid.conf
 | 
			
		||||
        mode: 0644
 | 
			
		||||
        backup: true
 | 
			
		||||
      notify: restart squid
 | 
			
		||||
 | 
			
		||||
  handlers:
 | 
			
		||||
    - name: restart squid
 | 
			
		||||
      service:
 | 
			
		||||
        name: squid
 | 
			
		||||
        state: restarted
 | 
			
		||||
 | 
			
		||||
# - name: Copie de squid.conf...
 | 
			
		||||
# fetch:
 | 
			
		||||
# src: /etc/squid/squid.conf
 | 
			
		||||
# dest: ./squid.conf.j2
 | 
			
		||||
# flat: yes
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								sio1/sisr1/80-ansible/tpansible/syslog-client-configure.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								sio1/sisr1/80-ansible/tpansible/syslog-client-configure.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
---
 | 
			
		||||
 - hosts: web
 | 
			
		||||
   name: syslog-client-configure
 | 
			
		||||
   tasks:
 | 
			
		||||
     - name: editing journald.conf...
 | 
			
		||||
       ansible.builtin.replace:
 | 
			
		||||
         path: /etc/systemd/journald.conf
 | 
			
		||||
         regexp: '^#ForwardToSyslog=yes'
 | 
			
		||||
         replace: 'ForwardToSyslog=yes'
 | 
			
		||||
         backup: yes
 | 
			
		||||
       notify: restart journald
 | 
			
		||||
 | 
			
		||||
     - name: editing rsyslog.conf...
 | 
			
		||||
       ansible.builtin.lineinfile:
 | 
			
		||||
         path: /etc/rsyslog.conf
 | 
			
		||||
         line: '*.* @192.168.0.48:514'
 | 
			
		||||
         create: yes
 | 
			
		||||
       notify: restart rsyslog
 | 
			
		||||
 | 
			
		||||
   handlers:
 | 
			
		||||
     - name: restart journald
 | 
			
		||||
       service:
 | 
			
		||||
         name: systemd-journald
 | 
			
		||||
         state: restarted
 | 
			
		||||
 | 
			
		||||
     - name: restart rsyslog
 | 
			
		||||
       service:
 | 
			
		||||
         name: rsyslog
 | 
			
		||||
         state: restarted
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										23
									
								
								sio1/sisr1/80-ansible/tpansible/syslog-server-configure.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								sio1/sisr1/80-ansible/tpansible/syslog-server-configure.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
---
 | 
			
		||||
- hosts: adm
 | 
			
		||||
  name: rsyslog-server-configure
 | 
			
		||||
  tasks:
 | 
			
		||||
    - name: activation du module imudp...
 | 
			
		||||
      ansible.builtin.replace:
 | 
			
		||||
        path: /etc/rsyslog.conf
 | 
			
		||||
        regexp: '^#module\(load="imudp"\)'
 | 
			
		||||
        replace: 'module(load="imudp")'
 | 
			
		||||
 | 
			
		||||
    - name: ouverture du port 514...
 | 
			
		||||
      ansible.builtin.replace:
 | 
			
		||||
        path: /etc/rsyslog.conf
 | 
			
		||||
        regexp: '^#input\(type="imudp" port="514"\)'
 | 
			
		||||
        replace: 'input(type="imudp" port="514")'
 | 
			
		||||
      notify: restart rsyslog
 | 
			
		||||
 | 
			
		||||
  handlers:
 | 
			
		||||
    - name: restart rsyslog
 | 
			
		||||
      service:
 | 
			
		||||
        name: rsyslog
 | 
			
		||||
        state: restarted
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										24
									
								
								sio1/sisr1/80-ansible/tpansible/web.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								sio1/sisr1/80-ansible/tpansible/web.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
---
 | 
			
		||||
- hosts: web
 | 
			
		||||
  name: web
 | 
			
		||||
  tasks:
 | 
			
		||||
    - name: verifying apache installation
 | 
			
		||||
      apt : 
 | 
			
		||||
        name: apache2
 | 
			
		||||
        state: present
 | 
			
		||||
 | 
			
		||||
    - name: verifying php installation
 | 
			
		||||
      apt :
 | 
			
		||||
       name: php
 | 
			
		||||
       state: present
 | 
			
		||||
           
 | 
			
		||||
    - name: verifying php-mbstring installation
 | 
			
		||||
      apt : 
 | 
			
		||||
       name: php-mbstring
 | 
			
		||||
       state: present
 | 
			
		||||
     
 | 
			
		||||
    - name: overwriting index.html...
 | 
			
		||||
      copy: 
 | 
			
		||||
        src: index.html
 | 
			
		||||
        dest: /var/www/html/index.html
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user