mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Change examples syntax on file module
This commit is contained in:
parent
6ea87c583b
commit
0c46813871
1 changed files with 26 additions and 6 deletions
|
@ -88,21 +88,41 @@ options:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# change file ownership, group and mode. When specifying mode using octal numbers, first digit should always be 0.
|
# change file ownership, group and mode. When specifying mode using octal numbers, first digit should always be 0.
|
||||||
- file: path=/etc/foo.conf owner=foo group=foo mode=0644
|
- file:
|
||||||
- file: src=/file/to/link/to dest=/path/to/symlink owner=foo group=foo state=link
|
path: /etc/foo.conf
|
||||||
- file: src=/tmp/{{ item.src }} dest={{ item.dest }} state=link
|
owner: foo
|
||||||
|
group: foo
|
||||||
|
mode: 0644
|
||||||
|
- file:
|
||||||
|
src: /file/to/link/to
|
||||||
|
dest: /path/to/symlink
|
||||||
|
owner: foo
|
||||||
|
group: foo
|
||||||
|
state: link
|
||||||
|
- file:
|
||||||
|
src: /tmp/{{ item.src }}
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
state: link
|
||||||
with_items:
|
with_items:
|
||||||
- { src: 'x', dest: 'y' }
|
- { src: 'x', dest: 'y' }
|
||||||
- { src: 'z', dest: 'k' }
|
- { src: 'z', dest: 'k' }
|
||||||
|
|
||||||
# touch a file, using symbolic modes to set the permissions (equivalent to 0644)
|
# touch a file, using symbolic modes to set the permissions (equivalent to 0644)
|
||||||
- file: path=/etc/foo.conf state=touch mode="u=rw,g=r,o=r"
|
- file:
|
||||||
|
path: /etc/foo.conf
|
||||||
|
state: touch
|
||||||
|
mode: "u=rw,g=r,o=r"
|
||||||
|
|
||||||
# touch the same file, but add/remove some permissions
|
# touch the same file, but add/remove some permissions
|
||||||
- file: path=/etc/foo.conf state=touch mode="u+rw,g-wx,o-rwx"
|
- file: path=/etc/foo.conf
|
||||||
|
state: touch
|
||||||
|
mode: "u+rw,g-wx,o-rwx"
|
||||||
|
|
||||||
# create a directory if it doesn't exist
|
# create a directory if it doesn't exist
|
||||||
- file: path=/etc/some_directory state=directory mode=0755
|
- file:
|
||||||
|
path: /etc/some_directory
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue