Uniwa 2020 ask Security
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

113 lines
2.0 KiB

---
- hosts: service
remote_user: docker
sudo: yes
gather_facts: no
vars:
user: "docker"
tasks:
# make directory
- name: make dir for data
become: true
file:
path: "/var/lab/playground/playground-readmongo"
state: directory
owner: docker
group: docker
mode: '0777'
# pare google.com
# - name: google.com
# become: yes
# become_user: "{{ user }}"
# command: curl http://www.google.com
# ignore_errors: yes
# register: configwww
# - name: ls configwww
# debug: var=configwww.stdout_lines
# rm dir
# - name: remove dir
# become: yes
# become_user: "{{ user }}"
# command: rmdir new_dir
# ignore_errors: yes
# register: rmvdir
# - name: ls rmvdir
# debug: var=rmvdir.stdout_lines
# transfer script iptables gia er. 1
- name: Transfer script iptables_rules.
copy: src=iptables_rules.sh dest=/home/docker mode=0777
# transfer script fail2ban gia er.2
- name: Transfer script fail2ban.
copy: src=fail2ban_script.sh dest=/home/docker mode=0777
# install openvpn gia er.4
- name: Ansible apt install openvpn.
become: true
apt:
name: openvpn
state: present
update_cache: true
# install fail2ban gia er.2
- name: Ansible apt install fail2ban.
become: true
apt:
name: fail2ban
state: present
update_cache: true
# ls -al for testing
- name: ls -al
become: yes
become_user: "{{ user }}"
command: ls -al #/etc
ignore_errors: yes
register: config
- name: ls config
debug: var=config.stdout_lines
# netstat -antlupe
# - name: netstat
# become: yes
# become_user: "{{ user }}"
# command: netstat -antlupe
# ignore_errors: yes
# register: ant
# - name: ls ant
# debug: var=ant.stdout_lines
- name: Refresh connection
meta: clear_host_errors