Skip to content

Commit

Permalink
Merge pull request #15 from timflannagan1/fix-install-commands
Browse files Browse the repository at this point in the history
Need to use set_fact instead of register to track whether a package has been installed.
  • Loading branch information
dwlehman authored Nov 30, 2018
2 parents c82378d + af1afd1 commit 742f3cf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
36 changes: 21 additions & 15 deletions tasks/fs-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,36 @@
- name: Stat the final device file
include_tasks: stat_device.yml

- name: Install xfsprogs for xfs file system type
package:
name: xfsprogs
state: present
register: xfsprogs_installed
- block:
- name: Install xfsprogs for xfs file system type
package:
name: xfsprogs
state: present
- set_fact:
xfsprogs_installed: true
when: "volume.fs_type == 'xfs' and ['xfsprogs'] is not subset(ansible_facts.packages.keys()) \
and xfsprogs_installed is undefined and not ansible_check_mode \
and ((pool is defined and pool.state in 'present') or volume.state in 'present')"

- name: Install e2fsprogs for ext file system type
package:
name: e2fsprogs
state: present
register: e2fsprogs_installed
- block:
- name: Install e2fsprogs for ext file system type
package:
name: e2fsprogs
state: present
- set_fact:
e2fsprogs_installed: true
when: "volume.fs_type in ['ext2', 'ext3', 'ext4'] and \
['e2fsprogs'] is not subset(ansible_facts.packages.keys()) and \
e2fsprogs_installed is undefined and not ansible_check_mode \
and ((pool is defined and pool.state in 'present') or volume.state in 'present')"

- name: Install util-linux as needed
package:
name: util-linux
state: present
register: util_linux_installed
- block:
- name: Install util-linux as needed
package:
name: util-linux
state: present
- set_fact:
util_linux_installed: true
when: "(volume.fs_type == 'swap' or volume.state == 'absent' or
(pool is defined and pool.state is defined and pool.state == 'absent'))
and ['util-linux'] is not subset(ansible_facts.packages.keys()) and
Expand Down
12 changes: 7 additions & 5 deletions tasks/pool-partition-default.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
- name: Install parted for partition management
package:
name: parted
state: present
register: parted_installed
- block:
- name: Install parted for partition management
package:
name: parted
state: present
- set_fact:
parted_installed: true
# update this condition when current use_partitions issue (#5) is fixed.
when: "use_partitions and ['parted'] is not subset(ansible_facts.packages.keys()) \
and parted_installed is undefined and not ansible_check_mode"
Expand Down

0 comments on commit 742f3cf

Please sign in to comment.