Skip to content

Commit

Permalink
Merge pull request #10 from MiLk/features/optional-facts
Browse files Browse the repository at this point in the history
Allow the user to choose the package manager manually
  • Loading branch information
MiLk authored Oct 13, 2016
2 parents e7093e2 + 7e86e2a commit 721f2a4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ disk_additional_disks:
You can add:
* `disk_user` sets owner of the mount directory (default: root)
* `disk_group` sets group of the mount directory (default: root)
* `disk_package_use` is the required package manager module to use (yum, apt, etc). The default 'auto' will use existing facts or try to autodetect it.

The following filesystems are currently supported:
- [ext2](http://en.wikipedia.org/wiki/Ext2)
Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
# Aditional disks that need to be formated and mouted.
# Aditional disks that need to be formated and mounted.
# See README for syntax and usage.
disk_additional_disks: []
disk_package_use: auto
32 changes: 12 additions & 20 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
- name: "Install util-linux"
- name: "Install parted"
package:
name: '{{ item }}'
state: 'present'
with_flattened:
- 'parted'
tags:
- disk
- pkgs
name: parted
state: present
use: '{{ disk_package_use }}'
when: disk_additional_disks
tags: ['disk', 'pkgs']

- name: "Partition additional disks"
shell: |
Expand All @@ -20,18 +17,16 @@
creates: '{{ item.disk }}1'
executable: '/bin/bash'
with_items: '{{ disk_additional_disks }}'
tags:
- disk
tags: ['disk']

- name: Create filesystem on the first partition
- name: "Create filesystem on the first partition"
filesystem:
dev: '{{ item.disk }}1'
force: '{{ item.force|d(omit) }}'
fstype: '{{ item.fstype }}'
opts: '{{ item.fsopts|d(omit) }}'
with_items: '{{ disk_additional_disks }}'
tags:
- disk
tags: ['disk']

- name: "Ensure the mount directory exists"
file:
Expand All @@ -40,16 +35,14 @@
group: '{{ disk_group | default("root") }}'
state: directory
with_items: '{{ disk_additional_disks }}'
tags:
- disk
tags: ['disk']

- name: Get UUID for partition
- name: "Get UUID for partition"
command: blkid -s UUID -o value "{{ item.disk }}1"
register: disk_blkid
with_items: '{{ disk_additional_disks }}'
changed_when: False
tags:
- disk
tags: ['disk']

- name: "Mount additional disk"
mount:
Expand All @@ -62,5 +55,4 @@
with_together:
- '{{ disk_additional_disks }}'
- '{{ disk_blkid.results }}'
tags:
- disk
tags: ['disk']

0 comments on commit 721f2a4

Please sign in to comment.