Detect default group in template integration test.
This commit is contained in:
parent
4859e0a419
commit
3fd13aaffe
1 changed files with 8 additions and 4 deletions
|
@ -16,6 +16,10 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
- name: get default group
|
||||||
|
shell: id -gn
|
||||||
|
register: group
|
||||||
|
|
||||||
- name: fill in a basic template
|
- name: fill in a basic template
|
||||||
template: src=foo.j2 dest={{output_dir}}/foo.templated mode=0644
|
template: src=foo.j2 dest={{output_dir}}/foo.templated mode=0644
|
||||||
register: template_result
|
register: template_result
|
||||||
|
@ -73,13 +77,13 @@
|
||||||
# VERIFY dest as a directory does not break file attributes
|
# VERIFY dest as a directory does not break file attributes
|
||||||
# Note: expanduser is needed to go down the particular codepath that was broken before
|
# Note: expanduser is needed to go down the particular codepath that was broken before
|
||||||
- name: setup directory for test
|
- name: setup directory for test
|
||||||
file: state=directory dest={{output_dir | expanduser}}/template-dir mode=0755 owner=nobody group={{ ansible_env.GROUP | default('root') }}
|
file: state=directory dest={{output_dir | expanduser}}/template-dir mode=0755 owner=nobody group={{ group.stdout }}
|
||||||
|
|
||||||
- name: set file mode when the destination is a directory
|
- name: set file mode when the destination is a directory
|
||||||
template: src=foo.j2 dest={{output_dir | expanduser}}/template-dir/ mode=0600 owner=root group={{ ansible_env.GROUP | default('root') }}
|
template: src=foo.j2 dest={{output_dir | expanduser}}/template-dir/ mode=0600 owner=root group={{ group.stdout }}
|
||||||
|
|
||||||
- name: set file mode when the destination is a directory
|
- name: set file mode when the destination is a directory
|
||||||
template: src=foo.j2 dest={{output_dir | expanduser}}/template-dir/ mode=0600 owner=root group={{ ansible_env.GROUP | default('root') }}
|
template: src=foo.j2 dest={{output_dir | expanduser}}/template-dir/ mode=0600 owner=root group={{ group.stdout }}
|
||||||
register: file_result
|
register: file_result
|
||||||
|
|
||||||
- name: check that the file has the correct attributes
|
- name: check that the file has the correct attributes
|
||||||
|
@ -103,7 +107,7 @@
|
||||||
- "dir_attrs.stat.mode == '0755'"
|
- "dir_attrs.stat.mode == '0755'"
|
||||||
|
|
||||||
- name: Check that template to a dirctory where the directory does not end with a / is allowed
|
- name: Check that template to a dirctory where the directory does not end with a / is allowed
|
||||||
template: src=foo.j2 dest={{output_dir | expanduser}}/template-dir mode=0600 owner=root group={{ ansible_env.GROUP | default('root') }}
|
template: src=foo.j2 dest={{output_dir | expanduser}}/template-dir mode=0600 owner=root group={{ group.stdout }}
|
||||||
|
|
||||||
- name: make a symlink to the templated file
|
- name: make a symlink to the templated file
|
||||||
file:
|
file:
|
||||||
|
|
Loading…
Reference in a new issue