|
5 | 5 | ansible.builtin.include_vars: "{{ cvmfs_repo }}.yml" |
6 | 6 |
|
7 | 7 | - name: Start transaction |
8 | | - ansible.builtin.command: "cvmfs_server transaction {{ cvmfs_repo }}" |
9 | | - when: cvmfs_start_transaction |
| 8 | + ansible.builtin.command: |
| 9 | + cmd: "cvmfs_server transaction {{ cvmfs_repo }}" |
| 10 | + creates: "/var/spool/cvmfs/{{ cvmfs_repo }}/in_transaction.lock" |
| 11 | + when: create_cvmfs_content_structure_start_transaction |
10 | 12 |
|
11 | 13 | - name: Apply changes to CVMFS repository, if there are any |
12 | 14 | block: |
13 | | - - name: "Create directories" |
14 | | - ansible.builtin.file: |
15 | | - path: "/cvmfs/{{ cvmfs_repo }}/{{ item.name }}" |
16 | | - state: directory |
17 | | - mode: "{{ item.mode }}" |
18 | | - with_items: "{{ directories }}" |
19 | | - register: create_directories |
20 | | - |
21 | | - - name: "Create symlinks" |
22 | | - ansible.builtin.file: |
23 | | - path: "/cvmfs/{{ cvmfs_repo }}/{{ item }}" |
24 | | - src: "{{ symlinks[item] }}" |
25 | | - state: link |
26 | | - force: true |
27 | | - with_items: "{{ symlinks }}" |
28 | | - register: create_symlinks |
29 | | - |
30 | | - - name: "Copy files" |
31 | | - ansible.builtin.copy: |
32 | | - src: "{{ item.name }}" |
33 | | - dest: "/cvmfs/{{ cvmfs_repo }}/{{ item.dest }}" |
34 | | - mode: "{{ item.mode }}" |
35 | | - with_items: "{{ files }}" |
36 | | - register: create_files |
37 | | - |
38 | | - - name: Publish transaction |
39 | | - ansible.builtin.command: "cvmfs_server publish {{ cvmfs_repo }}" |
40 | | - when: |
41 | | - - cvmfs_start_transaction |
42 | | - - cvmfs_publish_transaction |
43 | | - - create_symlinks.changed or create_files.changed |
44 | | - register: publish |
45 | | - |
46 | | - - name: Abort transaction |
47 | | - ansible.builtin.command: "cvmfs_server abort {{ cvmfs_repo }}" |
48 | | - when: publish is skipped |
| 15 | + - name: "Create directories" |
| 16 | + ansible.builtin.file: |
| 17 | + path: "/cvmfs/{{ cvmfs_repo }}/{{ item.name }}" |
| 18 | + state: directory |
| 19 | + mode: "{{ item.mode }}" |
| 20 | + with_items: "{{ directories }}" |
| 21 | + register: create_cvmfs_content_structure_create_directories |
| 22 | + |
| 23 | + - name: "Create symlinks" |
| 24 | + ansible.builtin.file: |
| 25 | + path: "/cvmfs/{{ cvmfs_repo }}/{{ item }}" |
| 26 | + src: "{{ symlinks[item] }}" |
| 27 | + state: link |
| 28 | + force: true |
| 29 | + with_items: "{{ symlinks }}" |
| 30 | + register: create_cvmfs_content_structure_create_symlinks |
| 31 | + |
| 32 | + - name: "Copy files" |
| 33 | + ansible.builtin.copy: |
| 34 | + src: "{{ item.name }}" |
| 35 | + dest: "/cvmfs/{{ cvmfs_repo }}/{{ item.dest }}" |
| 36 | + mode: "{{ item.mode }}" |
| 37 | + with_items: "{{ files }}" |
| 38 | + register: create_cvmfs_content_structure_create_files |
| 39 | + |
| 40 | + - name: Publish transaction |
| 41 | + ansible.builtin.command: |
| 42 | + cmd: "cvmfs_server publish {{ cvmfs_repo }}" |
| 43 | + removes: "/var/spool/cvmfs/{{ cvmfs_repo }}/in_transaction.lock" |
| 44 | + when: |
| 45 | + - create_cvmfs_content_structure_start_transaction |
| 46 | + - create_cvmfs_content_structure_publish_transaction |
| 47 | + - create_cvmfs_content_structure_create_symlinks.changed or |
| 48 | + create_cvmfs_content_structure_create_files.changed or |
| 49 | + create_cvmfs_content_structure_create_directories.changed |
| 50 | + register: create_cvmfs_content_structure_publish |
| 51 | + |
| 52 | + - name: Abort transaction |
| 53 | + ansible.builtin.command: |
| 54 | + cmd: "cvmfs_server abort {{ cvmfs_repo }}" |
| 55 | + removes: "/var/spool/cvmfs/{{ cvmfs_repo }}/in_transaction.lock" |
| 56 | + when: create_cvmfs_content_structure_publish is skipped |
49 | 57 |
|
50 | 58 | rescue: |
51 | 59 | - name: Abort transaction |
52 | | - ansible.builtin.command: "cvmfs_server abort -f {{ cvmfs_repo }}" |
53 | | - when: cvmfs_start_transaction and cvmfs_abort_transaction_on_failures |
| 60 | + ansible.builtin.command: |
| 61 | + cmd: "cvmfs_server abort {{ cvmfs_repo }}" |
| 62 | + removes: "/var/spool/cvmfs/{{ cvmfs_repo }}/in_transaction.lock" |
| 63 | + when: |
| 64 | + - create_cvmfs_content_structure_start_transaction |
| 65 | + - create_cvmfs_content_structure_abort_transaction_on_failures |
54 | 66 |
|
55 | 67 | - name: Exit because of failure |
56 | 68 | ansible.builtin.fail: |
|
0 commit comments