Linux/Ansible: Difference between revisions
< Linux
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== /srv/ansible-config/roles/<role-name>/tasks/main.yml == | == /srv/ansible-config/roles/<role-name>/tasks/main.yml == | ||
* apt | * apt: | ||
<blockquote><pre> | <blockquote><pre> | ||
- name: update apt | - name: update apt | ||
Line 12: | Line 12: | ||
name: ["aptitude", "git", "mc", "nmap"] | name: ["aptitude", "git", "mc", "nmap"] | ||
</pre></blockquote> | </pre></blockquote> | ||
* copy | * systemd: | ||
<blockquote><pre> | |||
- name: reload systemd config | |||
systemd: | |||
daemon_reload: yes | |||
- name: restart fail2ban | |||
systemd: | |||
name: fail2ban | |||
state: restarted | |||
</pre></blockquote> | |||
* copy files: | |||
<blockquote><pre> | <blockquote><pre> | ||
- name: copy openvpn client config files | - name: copy openvpn client config files | ||
Line 25: | Line 36: | ||
remote_src: yes | remote_src: yes | ||
</pre></blockquote> | </pre></blockquote> | ||
* | * edit files: | ||
<blockquote><pre> | <blockquote><pre> | ||
- name: | - name: enable openvpn in /etc/default/openvpn | ||
lineinfile: | |||
path: /etc/default/openvpn | |||
line: AUTOSTART="all" | |||
</pre></blockquote> | </pre></blockquote> | ||
Revision as of 14:43, 11 November 2018
/srv/ansible-config/roles/<role-name>/tasks/main.yml
- apt:
- name: update apt apt: update_cache: yes cache_valid_time: 3600 - name: install apt packages apt: name: ["aptitude", "git", "mc", "nmap"]
- systemd:
- name: reload systemd config systemd: daemon_reload: yes - name: restart fail2ban systemd: name: fail2ban state: restarted
- copy files:
- name: copy openvpn client config files copy: src: ../files/ dest: /etc/openvpn - name: enable fail2ban config copy: src: /etc/fail2ban/fail2ban.conf dest: /etc/fail2ban/fail2ban.local remote_src: yes
- edit files:
- name: enable openvpn in /etc/default/openvpn lineinfile: path: /etc/default/openvpn line: AUTOSTART="all"