Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [ansible] lineinfile.insertafter, lineinfile.insertbefore, pause…
….minutes and package.name (#1776) * add: test module_lineifile.json This does not pass the build * fix: "insertafter" and "insertbefore" Now also accept all string input * add: test module_pause.json This does not pass the build This is a copy from the example page. Also add "name": "..." or else it will not pass the build. This is an other issue that need to be fix * fix: pause "minutes" and "seconds" It is now integer and not string as the example note that the example also accept type "null" * add: test module_package.json This does not pass the build * fix: package "name" was only accepting string It now accept both string + array * empty commit * add: test module_package.json issue #509 Ansible schema doesn't handle lists passed to yum module But it is all ready fix * fix: module.template.validate must be type "string" see issue #1256 Ansible template type has an attribute validate which is set to boolean in the JSON schema, but should be string. * add: test module_copy.json issue #1256 Ansible template type has an attribute validate which is set to boolean in the JSON schema, but should be string. The copy one has the same validate type and should be checked and also corrected while working on this. But there is no "validate" proprety in the module.copy schema. I do not know how this is posible. This schema ia auto gererated from the documentation. Add test module_copy.json to check if any this else is wrong. The test module_copy.json does not detect this missing property because there is no "additionalProperties": false for this "properties"
- Loading branch information
1 parent
1148b3f
commit a22542a
Showing
6 changed files
with
361 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
[ | ||
{ | ||
"name": "Copy file with owner and permissions", | ||
"copy": { | ||
"src": "/srv/myfiles/foo.conf", | ||
"dest": "/etc/foo.conf", | ||
"owner": "foo", | ||
"group": "foo", | ||
"mode": "0644" | ||
} | ||
}, | ||
{ | ||
"name": "Copy file with owner and permission, using symbolic representation", | ||
"copy": { | ||
"src": "/srv/myfiles/foo.conf", | ||
"dest": "/etc/foo.conf", | ||
"owner": "foo", | ||
"group": "foo", | ||
"mode": "u=rw,g=r,o=r" | ||
} | ||
}, | ||
{ | ||
"name": "Another symbolic mode example, adding some permissions and removing others", | ||
"copy": { | ||
"src": "/srv/myfiles/foo.conf", | ||
"dest": "/etc/foo.conf", | ||
"owner": "foo", | ||
"group": "foo", | ||
"mode": "u+rw,g-wx,o-rwx" | ||
} | ||
}, | ||
{ | ||
"name": "Copy a new \"ntp.conf file into place, backing up the original if it differs from the copied version", | ||
"copy": { | ||
"src": "/mine/ntp.conf", | ||
"dest": "/etc/ntp.conf", | ||
"owner": "root", | ||
"group": "root", | ||
"mode": "0644", | ||
"backup": true | ||
} | ||
}, | ||
{ | ||
"name": "Copy a new \"sudoers\" file into place, after passing validation with visudo", | ||
"copy": { | ||
"src": "/mine/sudoers", | ||
"dest": "/etc/sudoers", | ||
"validate": "/usr/sbin/visudo -csf %s" | ||
} | ||
}, | ||
{ | ||
"name": "Copy a \"sudoers\" file on the remote machine for editing", | ||
"copy": { | ||
"src": "/etc/sudoers", | ||
"dest": "/etc/sudoers.edit", | ||
"remote_src": true, | ||
"validate": "/usr/sbin/visudo -csf %s" | ||
} | ||
}, | ||
{ | ||
"name": "Copy using inline content", | ||
"copy": { | ||
"content": "# This file was moved to /etc/other.conf", | ||
"dest": "/etc/mine.conf" | ||
} | ||
}, | ||
{ | ||
"name": "If follow=yes, /path/to/file will be overwritten by contents of foo.conf", | ||
"copy": { | ||
"src": "/etc/foo.conf", | ||
"dest": "/path/to/link", | ||
"follow": true | ||
} | ||
}, | ||
{ | ||
"name": "If follow=no, /path/to/link will become a file and be overwritten by contents of foo.conf", | ||
"copy": { | ||
"src": "/etc/foo.conf", | ||
"dest": "/path/to/link", | ||
"follow": false | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[ | ||
{ | ||
"name": "Ensure SELinux is set to enforcing mode", | ||
"lineinfile": { | ||
"path": "/etc/selinux/config", | ||
"regexp": "^SELINUX=", | ||
"line": "SELINUX=enforcing" | ||
} | ||
}, | ||
{ | ||
"name": "Make sure group wheel is not in the sudoers configuration", | ||
"lineinfile": { | ||
"path": "/etc/sudoers", | ||
"state": "absent", | ||
"regexp": "^%wheel" | ||
} | ||
}, | ||
{ | ||
"name": "Replace a localhost entry with our own", | ||
"lineinfile": { | ||
"path": "/etc/hosts", | ||
"regexp": "^127\\.0\\.0\\.1", | ||
"line": "127.0.0.1 localhost", | ||
"owner": "root", | ||
"group": "root", | ||
"mode": "0644" | ||
} | ||
}, | ||
{ | ||
"name": "Ensure the default Apache port is 8080", | ||
"lineinfile": { | ||
"path": "/etc/httpd/conf/httpd.conf", | ||
"regexp": "^Listen ", | ||
"insertafter": "^#Listen ", | ||
"line": "Listen 8080" | ||
} | ||
}, | ||
{ | ||
"name": "Ensure we have our own comment added to /etc/services", | ||
"lineinfile": { | ||
"path": "/etc/services", | ||
"regexp": "^# port for http", | ||
"insertbefore": "^www.*80/tcp", | ||
"line": "# port for http by default" | ||
} | ||
}, | ||
{ | ||
"name": "Add a line to a file if the file does not exist, without passing regexp", | ||
"lineinfile": { | ||
"path": "/tmp/testfile", | ||
"line": "192.168.1.99 foo.lab.net foo", | ||
"create": true | ||
} | ||
}, | ||
{ | ||
"name": "Ensure the JBoss memory settings are exactly as needed", | ||
"lineinfile": { | ||
"path": "/opt/jboss-as/bin/standalone.conf", | ||
"regexp": "^(.*)Xms(\\\\d+)m(.*)$", | ||
"line": "\\1Xms${xms}m\\3", | ||
"backrefs": true | ||
} | ||
}, | ||
{ | ||
"name": "Validate the sudoers file before saving", | ||
"lineinfile": { | ||
"path": "/etc/sudoers", | ||
"state": "present", | ||
"regexp": "^%ADMIN ALL=", | ||
"line": "%ADMIN ALL=(ALL) NOPASSWD: ALL", | ||
"validate": "/usr/sbin/visudo -cf %s" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[ | ||
{ | ||
"name": "install ntpdate", | ||
"package": { | ||
"name": "ntpdate", | ||
"state": "present" | ||
} | ||
}, | ||
{ | ||
"name": "remove the apache package", | ||
"package": { | ||
"name": "{{ apache }}", | ||
"state": "absent" | ||
} | ||
}, | ||
{ | ||
"name": "install the latest version of Apache and MariaDB", | ||
"package": { | ||
"name": [ | ||
"httpd", | ||
"mariadb-server" | ||
], | ||
"state": "latest" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[ | ||
{ | ||
"name": "a", | ||
"pause": { | ||
"minutes": 5 | ||
} | ||
}, | ||
{ | ||
"name": "b", | ||
"pause": null | ||
}, | ||
{ | ||
"name": "c", | ||
"pause": { | ||
"prompt": "Make sure org.foo.FooOverload exception is not present" | ||
} | ||
}, | ||
{ | ||
"name": "d", | ||
"pause": { | ||
"prompt": "Enter a secret", | ||
"echo": false | ||
} | ||
} | ||
] |
Oops, something went wrong.