file_deployment
file_deployment
This is a very simple role that will copy files to the managed nodes using ansible.builtin.copy
.
Badges
Badge |
---|
Workflow badges are in a separate section to not clutter this section.
Tested Ansible Core versions and operating systems
This role is tested using molecule
. Please take a look at our documentation to read more about it.
Role Variables
variable | default | required | description |
---|---|---|---|
fd_files |
unset | true | Files to deploy. See below for an extended example how to define it |
fd_quiet_assert |
false |
false | Whether to quiet the assert statements |
Variable fd_files
An extended example of only the fd_files
variable is illustrated down below:
fd_files:
- src: 'sshd_motd'
dest: '/etc/motd'
owner: 'root'
group: 'root'
mode: '0644'
- src: 'sshd_issue.net'
dest: '/etc/issue.net'
owner: 'root'
group: 'root'
mode: '0644'
- content: >-
This is my text
dest: '/home/steffen/test'
owner: 'steffen'
group: 'steffen'
mode: '0400'
The attributes dest
, owner
, group
and mode
are required as well as either src
or content
.
The permission attributes are deliberately enforced (although ansible.builtin.copy
does not require them) to avoid accidental unsafe file deployments which have too
broad permissions. This way, a user needs to consciously decide to set broad permissions.
Type validation for each variable and/or variable option is done using
role argument validation. The corresponding specification is
defined in meta/argument_specs.yml
.
This role supports all attributes of ansible.builtin.copy
being passed in as option
in fd_files
.
The role's argument specification does not replicate all the documentation specified in ansible.builtin.copy
as it is mainly used for type checking and type enforcement.
The complete documentation of each of the options possible can be reviewed at the
documentation of ansible.builtin.copy
Dependencies
None
Example Playbook
---
- name: 'Deploy files'
hosts: 'all'
gather_facts: false
roles:
- role: 'file_deployment'
vars:
fd_quiet_assert: false
fd_files:
- src: 'sshd_motd'
dest: '/etc/motd'
owner: 'root'
group: 'root'
mode: '0644'
- src: 'sshd_issue.net'
dest: '/etc/issue.net'
owner: 'root'
group: 'root'
mode: '0644'
- content: >-
This is my text
dest: '/home/steffen/test'
owner: 'steffen'
group: 'steffen'
mode: '0400'
...
Contributing
First off, thanks for taking the time to contribute! ❤️
All types of contributions are encouraged and valued.
Please see CONTRIBUTING.md
for different ways to help and details about how this project handles contributions.
Workflow badges
Workflow name |
---|
License
ansible-galaxy install sscheib/ansible-role-file_deployment