Teil 11 Loops
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| test | ||||
|  | ||||
							
								
								
									
										8
									
								
								loop.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								loop.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| - hosts: "{{ target }}" | ||||
|   vars_files: | ||||
|     - loop_files.yml | ||||
|   gather_facts: false | ||||
|   remote_user: pi | ||||
|   roles: | ||||
|     - loop | ||||
|  | ||||
							
								
								
									
										7
									
								
								loop_files.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								loop_files.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| testfiles: | ||||
|     - test1.txt | ||||
|     - test1.json | ||||
|     - test2.txt | ||||
|     - test3.txt | ||||
|     - test4.dat | ||||
|  | ||||
							
								
								
									
										8
									
								
								noloop.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								noloop.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| - hosts: "{{ target }}" | ||||
|   vars_files: | ||||
|     - loop_files.yml | ||||
|   gather_facts: false | ||||
|   remote_user: pi | ||||
|   roles: | ||||
|     - noloop | ||||
|  | ||||
							
								
								
									
										7
									
								
								roles/loop/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								roles/loop/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| - include: ../subtasks/setuploop.yml | ||||
|  | ||||
| - name: erzeuge Testdateien | ||||
|   ansible.builtin.file: | ||||
|     path: "test/{{ item }}" | ||||
|     state: touch | ||||
|   loop: "{{ testfiles }}" | ||||
							
								
								
									
										21
									
								
								roles/noloop/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								roles/noloop/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| - include: ../subtasks/setuploop.yml | ||||
| - name: erzeuge test1.txt | ||||
|   ansible.builtin.file: | ||||
|     path: "test/test1.txt" | ||||
|     state: touch | ||||
| - name: erzeuge test1.json | ||||
|   ansible.builtin.file: | ||||
|     path: "test/test1.json" | ||||
|     state: touch | ||||
| - name: erzeuge test2.txt | ||||
|   ansible.builtin.file: | ||||
|     path: "test/test2.txt" | ||||
|     state: touch | ||||
| - name: erzeuge test3.txt | ||||
|   ansible.builtin.file: | ||||
|     path: "test/test3.txt" | ||||
|     state: touch | ||||
| - name: erzeuge testr4.dat | ||||
|   ansible.builtin.file: | ||||
|     path: "test/test4.dat" | ||||
|     state: touch | ||||
							
								
								
									
										10
									
								
								roles/subtasks/setuploop.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								roles/subtasks/setuploop.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| ---  | ||||
| - name: create test dir | ||||
|   ansible.builtin.file: | ||||
|     path: test | ||||
|     state: directory | ||||
| - name: delete test files | ||||
|   ansible.builtin.file: | ||||
|     path: "test/*" | ||||
|     state: absent | ||||
|  | ||||
							
								
								
									
										13
									
								
								roles/with_items/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								roles/with_items/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| - include: ../subtasks/setuploop.yml | ||||
|  | ||||
| - name: erzeuge Testdateien | ||||
|   ansible.builtin.file: | ||||
|     path: "test/{{ item }}" | ||||
|     state: touch | ||||
|   with_items: | ||||
|     - test1.txt | ||||
|     - test1.json | ||||
|     - test2.txt | ||||
|     - test3.txt | ||||
|     - test4.dat | ||||
|  | ||||
							
								
								
									
										8
									
								
								with_items.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								with_items.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| - hosts: "{{ target }}" | ||||
|   vars_files: | ||||
|     - loop_files.yml | ||||
|   gather_facts: false | ||||
|   remote_user: pi | ||||
|   roles: | ||||
|     - with_items | ||||
|  | ||||
		Reference in New Issue
	
	Block a user