Skip to content

Commit 742f3cf

Browse files
authored
Merge pull request #15 from timflannagan1/fix-install-commands
Need to use set_fact instead of register to track whether a package has been installed.
2 parents c82378d + af1afd1 commit 742f3cf

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

tasks/fs-default.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,36 @@
22
- name: Stat the final device file
33
include_tasks: stat_device.yml
44

5-
- name: Install xfsprogs for xfs file system type
6-
package:
7-
name: xfsprogs
8-
state: present
9-
register: xfsprogs_installed
5+
- block:
6+
- name: Install xfsprogs for xfs file system type
7+
package:
8+
name: xfsprogs
9+
state: present
10+
- set_fact:
11+
xfsprogs_installed: true
1012
when: "volume.fs_type == 'xfs' and ['xfsprogs'] is not subset(ansible_facts.packages.keys()) \
1113
and xfsprogs_installed is undefined and not ansible_check_mode \
1214
and ((pool is defined and pool.state in 'present') or volume.state in 'present')"
1315

14-
- name: Install e2fsprogs for ext file system type
15-
package:
16-
name: e2fsprogs
17-
state: present
18-
register: e2fsprogs_installed
16+
- block:
17+
- name: Install e2fsprogs for ext file system type
18+
package:
19+
name: e2fsprogs
20+
state: present
21+
- set_fact:
22+
e2fsprogs_installed: true
1923
when: "volume.fs_type in ['ext2', 'ext3', 'ext4'] and \
2024
['e2fsprogs'] is not subset(ansible_facts.packages.keys()) and \
2125
e2fsprogs_installed is undefined and not ansible_check_mode \
2226
and ((pool is defined and pool.state in 'present') or volume.state in 'present')"
2327

24-
- name: Install util-linux as needed
25-
package:
26-
name: util-linux
27-
state: present
28-
register: util_linux_installed
28+
- block:
29+
- name: Install util-linux as needed
30+
package:
31+
name: util-linux
32+
state: present
33+
- set_fact:
34+
util_linux_installed: true
2935
when: "(volume.fs_type == 'swap' or volume.state == 'absent' or
3036
(pool is defined and pool.state is defined and pool.state == 'absent'))
3137
and ['util-linux'] is not subset(ansible_facts.packages.keys()) and

tasks/pool-partition-default.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
2-
- name: Install parted for partition management
3-
package:
4-
name: parted
5-
state: present
6-
register: parted_installed
2+
- block:
3+
- name: Install parted for partition management
4+
package:
5+
name: parted
6+
state: present
7+
- set_fact:
8+
parted_installed: true
79
# update this condition when current use_partitions issue (#5) is fixed.
810
when: "use_partitions and ['parted'] is not subset(ansible_facts.packages.keys()) \
911
and parted_installed is undefined and not ansible_check_mode"

0 commit comments

Comments
 (0)