Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

Mount module

ANSIBLE VERSION

Tested on both versions:

ansible-playbook 2.2.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

and

ansible-playbook 2.3.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

CONFIGURATION

Default

OS / ENVIRONMENT

Manager OS: CentOS Linux release 7.3.1611 (Core)

TargetOS (Tested): Ubuntu 16.04, CentOS 6.8

SUMMARY

Mount module do not allow to create several mount points with name: "none", so it is impossible to use this module to manage swap files mount point. During this operation this module overwrites already existent line.

STEPS TO REPRODUCE

- name: Swapfile | Install | Add swap entry in fstab
become: True
mount:
name: none
src: "/swapfile"
fstype: swap
opts: sw
dump: 0
passno: 0
state: present

EXPECTED RESULTS

I am expecting to get fstab file with two swap lines. One from default Ubuntu installation, and one from this command. Should be looks like this:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=b3130c85-0e01-4501-8243-5d8982451909 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=8f70f922-924e-4951-ba10-04d61297b8f7 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/swapfile none swap sw 0 0

ACTUAL RESULTS

Actually default swap entry is missing after this execution, and fstab looks like this:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=b3130c85-0e01-4501-8243-5d8982451909 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
//swapfile none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

Execution log with -vvvv enabled (Gist link)

Issue 2:
From @changyy on 2016-01-14T06:22:57Z

ISSUE TYPE

Feature Idea

COMPONENT NAME

service module

ANSIBLE VERSION

N/A

SUMMARY

Hi,

I would like to use service module to finish my job but current structure of the service module is not good enough.

Example:

$ service nginx
Usage: /etc/init.d/nginx {start|stop|status|restart|reload|force-reload|upgrade|configtest}
$ sudo service nginx configtest
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

But the current status of the Ansible service module is not supported for this usage. There are only predefined states, ['running', 'started', 'stopped', 'restarted', 'reloaded'], could be used.

And using shell module will get a warning message:

- name: test nginx config
shell: service nginx configtest
register: result
changed_when: "result.rc != 0"
always_run: yes

$ ansible running...
[WARNING]: Consider using service module rather than running service

So I just try to make a patch for it and name the new state "comannd" for demo the usage. Please feel free to modify the keywords or any codes. I just to present a demo solution from my thinking.

Usage:

- name: test nginx config
service: name=nginx state=command arguments=configtest

Copied from original issue: ansible/ansible-modules-core#2809