Samuli Silvius | 9367c59 | 2019-03-22 09:33:05 +0200 | [diff] [blame] | 1 | --- |
| 2 | - name: Install file exacutable if not there for archive compression checking |
| 3 | package: |
| 4 | name: file |
| 5 | state: present |
| 6 | |
| 7 | - name: "Create resource dir {{ resources_dir }}" |
| 8 | file: |
| 9 | path: "{{ resources_dir }}/{{ subdir }}" |
| 10 | state: directory |
| 11 | |
| 12 | - name: Create test files for the dummy packages |
| 13 | file: |
| 14 | path: "{{ item }}" |
| 15 | state: touch |
| 16 | loop: |
| 17 | - "{{ resources_dir }}/resource1.txt" |
| 18 | - "{{ resources_dir }}/resource2.txt" |
| 19 | - "{{ resources_dir }}/resource3.txt" |
| 20 | - "{{ resources_dir }}/{{ subdir }}/resource4.txt" |
| 21 | - "{{ resources_dir }}/auxdata" |
| 22 | |
| 23 | - name: Create resources tar archive for testing |
| 24 | archive: |
| 25 | path: |
| 26 | - "{{ resources_dir }}/resource*" |
| 27 | - "{{ resources_dir }}/{{ subdir }}/resource*" |
| 28 | dest: "{{ resources_dir }}/{{ resources_filename }}" |
| 29 | when: |
| 30 | - resources_filename is defined |
| 31 | - resources_filename is not none |
| 32 | |
| 33 | - name: Create aux tar archive for testing |
| 34 | archive: |
| 35 | path: "{{ resources_dir }}/aux*" |
| 36 | dest: "{{ resources_dir }}/{{ aux_resources_filename }}" |
| 37 | when: |
| 38 | - aux_resources_filename is defined |
| 39 | - aux_resources_filename is not none |
| 40 | |
| 41 | - block: |
| 42 | - name: Install nfs-utils |
| 43 | package: |
| 44 | name: nfs-utils |
| 45 | state: present |
| 46 | |
| 47 | - name: Start services |
| 48 | systemd: |
| 49 | name: "{{ item }}" |
| 50 | state: started |
| 51 | loop: |
| 52 | - rpcbind |
| 53 | - nfs |
| 54 | |
| 55 | - name: Create data dir to host machine for nfs mount. Must match with volume mount in molecule.yml |
| 56 | file: |
| 57 | path: ~{{ resources_dir }} |
| 58 | state: directory |
| 59 | delegate_to: localhost |
| 60 | |
| 61 | - name: Add hosts to exports |
| 62 | template: |
| 63 | src: exports.j2 |
| 64 | dest: /etc/exports |
| 65 | vars: |
| 66 | nfs_mount_path: "{{ resources_dir }}" |
| 67 | |
| 68 | - name: Export nfs |
| 69 | command: exportfs -ar |
| 70 | when: |
| 71 | - resources_on_nfs is defined |
| 72 | - resources_on_nfs |