Stemping the server
Alot of the times u don't know what has changed on the given server
- This gives u ability to see what has change before the previous configuration
Delegating
- By defulat the ansible copies the files to all the host
- To prevent that use delegate_to local host
Template module
- name: use Jinja2 template to configure vsftpd
template:
src: vsftpd.j2
dest: /etc/vsftpd/vsftpd.conf
-
Example Template
#[ansible@controller templates]$ cat vsftpd.j2 anonymous_enable={{ anonymous_enable }} local_enable={{ local_enable }} write_enable={{ write_enable }} anon_upload_enable={{ anon_upload_enable }} dirmessage_enable: YES xferlog_enable: YES connect_from_port_20: YES pam_service_name: vsftpd userlist_enable: YES # MY IP Address={{ ansible_facts['default_ipv4']['address'] }}
Filtering the nodes
-
Shorter one
-
Longer one